Ana içeriğe geç

Email Connection

General Information​

Connection Type​

email

UI Documentation​

Endpoints​

List Connections​

GET /apiops/projects/{projectName}/connections/?type=email

Get Connection​

GET /apiops/projects/{projectName}/connections/{connectionName}/

Create Connection​

POST /apiops/projects/{projectName}/connections/{connectionName}/

Update Connection​

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Delete Connection​

DELETE /apiops/projects/{projectName}/connections/{connectionName}/

List Connections​

Endpoint​

GET /apiops/projects/{projectName}/connections/?type=email

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Note: The type query parameter is required to filter connections by type.

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/" \
-H "Authorization: Bearer YOUR_TOKEN"

Get Connection​

Endpoint​

GET /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Response​

Success Response (200 OK)​

{
"success": true,
"resultList": [
{
"type": "email",
"name": "my-email-connection",
"description": "Email connection for notifications",
"enabled": true,
"host": "smtp.example.com",
"port": 587,
"username": "user@example.com",
"password": "actual-password",
"enableStartTls": true,
"certificateName": "smtp-ca-certificate",
"auth": true,
"defaultEncoding": "UTF-8",
"addressToTest": "test@example.com",
"from": "noreply@example.com",
"additionalProperties": []
}
],
"resultCount": 1
}

Note: password is never returned by get or list operations (null). Omit it on update to keep the stored value; send "" to clear it.

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/my-email-connection/" \
-H "Authorization: Bearer YOUR_TOKEN"

Create Connection​

Endpoint​

POST /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name (must match name in body)

Request Body​

Full JSON Body Example​
{
"type": "email",
"name": "my-email-connection",
"description": "Email connection for sending notifications",
"enabled": true,
"host": "smtp.gmail.com",
"port": 587,
"enableStartTls": true,
"certificateName": "smtp-ca-certificate",
"auth": true,
"username": "user@example.com",
"password": "app-password",
"defaultEncoding": "UTF-8",
"addressToTest": "test@example.com",
"from": "noreply@example.com",
"additionalProperties": []
}
Request Body Fields​
Common Fields​
FieldTypeRequiredDefaultDescription
typestringYes-Connection type discriminator field. Identifies the connection type in API requests/responses.
namestringYes-Connection name (must match path parameter)
descriptionstringNo-Connection description
enabledbooleanNotrueWhether connection is enabled
Email-Specific Fields​
FieldTypeRequiredDefaultDescription
hoststringYes-SMTP server hostname
portintegerNo587SMTP server port
enableStartTlsbooleanNofalseEnable STARTTLS
certificateNamestringNo-Certificate name used to validate the SMTP server
authbooleanNofalseEnable authentication
usernamestringNo*-SMTP username (required if auth=true)
passwordstringNo*-SMTP password (required if auth=true, secret field)
defaultEncodingstringNoUTF-8Default email encoding
addressToTeststringNo-Email address for testing
fromstringNo-Default sender email address
additionalPropertiesarrayNo[]Additional SMTP properties

Note: username and password are required when auth is true.

Response​

Success Response (200 OK)​

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}

cURL Example​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/my-email-connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "email",
"name": "my-email-connection",
"description": "Email connection for sending notifications",
"enabled": true,
"host": "smtp.gmail.com",
"port": 587,
"enableStartTls": true,
"auth": true,
"username": "user@example.com",
"password": "app-password",
"defaultEncoding": "UTF-8",
"from": "noreply@example.com"
}'

Update Connection​

Endpoint​

PUT /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name (must match name in body)

Request Body​

Full JSON Body Example​
{
"type": "email",
"name": "my-email-connection",
"description": "Updated email connection description",
"enabled": true,
"host": "smtp.gmail.com",
"port": 587,
"enableStartTls": true,
"certificateName": "smtp-ca-certificate",
"auth": true,
"username": "updated-user@example.com",
"password": "new-app-password",
"defaultEncoding": "UTF-8",
"from": "noreply@example.com",
"additionalProperties": []
}

Note: Request body structure is the same as Create Connection. certificateName is the only public certificate reference: absent or null preserves a valid stored reference, "" clears it, and a non-empty name replaces it. Internal certificateId is rejected and never returned.

Response​

Success Response (200 OK)​

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [...]
}
}

cURL Example​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/my-email-connection/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "email",
"name": "my-email-connection",
"description": "Updated email connection description",
"enabled": true,
"host": "smtp.gmail.com",
"port": 587,
"enableStartTls": true,
"auth": true,
"username": "updated-user@example.com",
"password": "new-app-password",
"defaultEncoding": "UTF-8",
"from": "noreply@example.com"
}'

Delete Connection​

Endpoint​

DELETE /apiops/projects/{projectName}/connections/{connectionName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
connectionNamestringYesConnection name

Response​

Success Response (200 OK)​

{
"success": true,
"deploymentResult": {
"success": true,
"deploymentResults": [...]
}
}

cURL Example​

curl -X DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/connections/my-email-connection/" \
-H "Authorization: Bearer YOUR_TOKEN"

Notes and Warnings​

  • Secret Fields: password is a secret field. Never commit it to version control

  • List vs Get: In list operations, password is returned as null. Use Get Connection to retrieve the full password

  • Authentication: If auth: true, both username and password are required

  • STARTTLS: Enable enableStartTls for secure SMTP connections (typically port 587)

  • Certificate Reference: Use certificateName; APIops never accepts or returns the internal certificate ID

  • Ports: Common SMTP ports:

    • 25 - Standard SMTP (often blocked)
    • 587 - SMTP with STARTTLS (recommended)
    • 465 - SMTP with SSL/TLS
  • Gmail: For Gmail, use an app password instead of your regular password

  • Deployment: Saving the connection deploys it to the workers; the response carries the deployment result.

  • Name Matching: Path parameter connectionName must match the name field in the request body