Upload a custom certificate
const url = 'https://api.nsin.ir/domains/example.com/ssl/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"certificate":"example","private_key":"example","hostnames":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The domain name (for example example.com) — not a numeric id.
Example
example.comRequest Body required
Section titled “Request Body required ”object
PEM-encoded certificate chain. Include intermediates — a leaf-only bundle makes clients fail chain verification.
PEM-encoded private key matching the certificate.
Which of the certificate’s SANs this upload should cover. Use the
eligible list from POST /domains/{domain}/ssl/parse.
Example generated
{ "certificate": "example", "private_key": "example", "hostnames": [ "example" ]}Responses
Section titled “ Responses ”Certificate installed.
object
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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}Missing, malformed, revoked or expired API key — or the owning account is inactive.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "invalid API key"}Read-only key, insufficient role, or the plan does not include custom certificates.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
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.
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Example
{ "error": "read-only API key"}The key exceeded its request budget (300 requests per minute by default).
The single error shape used by every endpoint.
object
Human-readable description of what went wrong.
Examples
{ "error": "rate limit exceeded"}