Ana içeriğe atla

Endpoint

POST /apiops/projects/{projectName}/certificates/

Authentication

Requires a Personal API Access Token.
Authorization: Bearer YOUR_TOKEN

Request

Headers

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typemultipart/form-dataYes

Path Parameters

ParameterTypeRequiredDescription
projectNamestringYesProject name

Form Data

ParameterTypeRequiredDescription
certificateNamestringYesCertificate name (unique identifier)
aliasstringYesCertificate alias (unique per environment)
certificateDescriptionstringYesCertificate description
environmentListarray[string]YesComma-separated list of environment names to deploy to
pemEncodedFilefileYesPEM-encoded certificate file

Notes

  • certificateName must be unique within the project
  • alias must be unique per environment (can be same across environments)
  • environmentList is comma-separated (e.g., “production,staging”)
  • pemEncodedFile must be a valid PEM-encoded certificate file
  • Certificate file must not be empty
  • Certificate is automatically deployed to all specified environments

PEM File Format

The certificate file should be in PEM format:
-----BEGIN CERTIFICATE-----
MIIFXTCCBEWgAwIBAgIQ...
(base64 encoded certificate content)
...
-----END CERTIFICATE-----

Response

Success Response (200 OK)

{
  "success": true,
  "deploymentResult": {
    "success": true,
    "message": "Deployment completed successfully",
    "environmentResults": [
      {
        "environmentName": "production",
        "success": true,
        "message": "Deployed successfully"
      },
      {
        "environmentName": "staging",
        "success": true,
        "message": "Deployed successfully"
      }
    ]
  }
}

Error Response (400 Bad Request)

{
  "error": "bad_request",
  "error_description": "certificateName value can not be empty!"
}
or
{
  "error": "bad_request",
  "error_description": "alias value can not be empty!"
}
or
{
  "error": "bad_request",
  "error_description": "pemEncodedFile value can not be empty!"
}
or
{
  "error": "bad_request",
  "error_description": "environmentList value can not be empty!"
}
or
{
  "error": "bad_request",
  "error_description": "Certificate (name: my-certificate) is already exist!"
}
or
{
  "error": "bad_request",
  "error_description": "Alias (my-cert-alias) is already used for another certificate, try changing this value!"
}

Common Causes

  • Missing required form fields
  • Certificate name already exists
  • Alias already exists in the environment
  • Invalid PEM file format
  • Empty certificate file
  • Environment does not exist

cURL Example

Example 1: Create Certificate with Single Environment

curl -X POST \
  "https://demo.apinizer.com/apiops/projects/MyProject/certificates/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "certificateName=my-certificate" \
  -F "alias=my-cert-alias" \
  -F "certificateDescription=SSL certificate for API" \
  -F "environmentList=production" \
  -F "[email protected]"

Example 2: Create Certificate with Multiple Environments

curl -X POST \
  "https://demo.apinizer.com/apiops/projects/MyProject/certificates/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -F "certificateName=my-certificate" \
  -F "alias=my-cert-alias" \
  -F "certificateDescription=SSL certificate for API" \
  -F "environmentList=production,staging,development" \
  -F "[email protected]"

Notes and Warnings

  • Certificate Name:
    • Must be unique within the project
    • Cannot be changed after creation
  • Alias:
    • Must be unique per environment
    • Same alias can be used in different environments
    • Used for certificate identification in keystore
  • PEM File Format:
    • Certificate must be in PEM format
    • File must include BEGIN and END markers
    • Base64 content between markers
  • Environment List:
    • Comma-separated list of environment names
    • All environments must exist
    • Certificate is deployed to all specified environments
  • Automatic Deployment:
    • Certificate is automatically deployed after creation
    • Deployment results are returned in the response
    • Failed deployments are included in environmentResults
  • Certificate Validation:
    • Certificate is validated during creation
    • Invalid certificates will cause creation to fail

Permissions

User must have SECRETS + MANAGE permission in the project. For deployment operations (when deploying certificates to environments), user must also have SECRETS + DEPLOY_UNDEPLOY permission.