Upload a custom certificate
Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.
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. Omitted, it is the apex and its wildcard (example.com,
*.example.com), so the certificate must carry both.
The upload is pinned: those hostnames serve it from now on, ahead of
the certificate NSIN manages, and edge nodes pick it up within seconds.
A certificate browsers would not trust is refused — a private CA (for
example a Cloudflare Origin CA certificate), a self-signed one, or a
chain missing its intermediate (code says which). Requires
ssl.manage and a plan that includes custom certificates.
Path parameters
- domainstringrequiredpath
The domain name (for example
example.com) — not a numeric id.
Request body
Content type: application/json · required
- certificatestringrequired
PEM-encoded certificate chain. Include intermediates — a leaf-only bundle makes clients fail chain verification.
- private_keystringrequired
PEM-encoded private key matching the certificate.
- hostnamesarray of string
Which of the certificate's SANs this upload should cover. Use the
eligiblelist fromPOST /domains/{domain}/ssl/parse.
Responses
200Certificate installed.
Content type: application/json
- messagestring
- domainstring
- hostnamesarray of string
- expires_atstring (date-time)
- issued_atstring (date-time)
- subjectstring
- sansarray of string
{
"message": "string",
"domain": "string",
"hostnames": [
"string"
],
"expires_at": "2026-01-01T00:00:00Z",
"issued_at": "2026-01-01T00:00:00Z",
"subject": "string",
"sans": [
"string"
]
}400Missing fields, unparseable PEM, an encrypted private key,
key/certificate mismatch, a hostname the certificate does not cover
or that is not part of this domain — or a certificate browsers
would not accept: code is cert_untrusted or
cert_incomplete_chain (with issuer and the raw trust_error),
or cert_expired / cert_not_yet_valid when the certificate is
outside its validity dates (with expires_at / valid_from).
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
- codestring
cert_untrusted— the issuer is not a public CA, or the certificate is self-signed.cert_incomplete_chain— the intermediate certificate is missing; paste the full chain.cert_expired— the certificate'snotAfterhas passed; renew it and upload the new one.cert_not_yet_valid— itsnotBeforeis still in the future.One of:"cert_untrusted""cert_incomplete_chain""cert_expired""cert_not_yet_valid" - issuerstring
The certificate's issuer.
- trust_errorstring
The underlying verification error.
- expires_atstring (date-time)
With
cert_expired: when the certificate expired. - valid_fromstring (date-time)
With
cert_not_yet_valid: when the certificate becomes valid.
{
"error": "This certificate is missing its intermediate certificate. …",
"code": "cert_incomplete_chain",
"issuer": "CN=R11,O=Let's Encrypt,C=US",
"trust_error": "x509: certificate signed by unknown authority"
}401Missing, malformed, revoked or expired API key. (A valid key whose
account has been deactivated gets 403 account is inactive instead.)
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "invalid API key"
}402The domain has no active plan.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}403Read-only key, insufficient role, or the plan does not include custom certificates.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}404No such domain, or it is not visible to this account. Domains you cannot access are reported as not found rather than forbidden.
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "read-only API key"
}429The key exceeded its request budget (300 requests per minute by default).
Content type: application/json
- errorstringrequired
Human-readable description of what went wrong.
{
"error": "rate limit exceeded"
}Example request
curl -X POST "https://api.nsin.ir/domains/example.com/ssl/" \
-H "Authorization: Bearer $NSIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"certificate": "string",
"private_key": "string",
"hostnames": [
"string"
]
}'