Skip to content

Upload a custom certificate

POST
/domains/{domain}/ssl/
curl --request POST \
--url https://api.nsin.ir/domains/example.com/ssl/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "certificate": "example", "private_key": "example", "hostnames": [ "example" ] }'

Installs your own certificate and private key for the domain. Include the full chain (leaf and intermediates) in certificate — a leaf-only upload makes clients fail chain verification.

hostnames selects which of the certificate’s SANs this upload should cover; use the eligible list from POST /domains/{domain}/ssl/parse to pick them. Requires ssl.manage and a plan that includes custom certificates.

domain
required
string

The domain name (for example example.com) — not a numeric id.

Example
example.com
Media type application/json
object
certificate
required

PEM-encoded certificate chain. Include intermediates — a leaf-only bundle makes clients fail chain verification.

string
private_key
required

PEM-encoded private key matching the certificate.

string
hostnames

Which of the certificate’s SANs this upload should cover. Use the eligible list from POST /domains/{domain}/ssl/parse.

Array<string>
Example generated
{
"certificate": "example",
"private_key": "example",
"hostnames": [
"example"
]
}

Certificate installed.

Media type application/json
object
message
string
domain
string
hostnames
Array<string>
expires_at
string format: date-time
issued_at
string format: date-time
subject
string
sans
Array<string>
Example generated
{
"message": "example",
"domain": "example",
"hostnames": [
"example"
],
"expires_at": "2026-04-15T12:00:00Z",
"issued_at": "2026-04-15T12:00:00Z",
"subject": "example",
"sans": [
"example"
]
}

Missing fields, unparseable PEM, key/certificate mismatch, an expired certificate, or a hostname that the certificate does not cover.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

Missing, malformed, revoked or expired API key — or the owning account is inactive.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example invalidKey
{
"error": "invalid API key"
}

Read-only key, insufficient role, or the plan does not include custom certificates.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Example
{
"error": "read-only API key"
}

The key exceeded its request budget (300 requests per minute by default).

Media type application/json

The single error shape used by every endpoint.

object
error
required

Human-readable description of what went wrong.

string
Examples
Example limited
{
"error": "rate limit exceeded"
}