nsindocs Search the docs⌘K
  1. Docs
  2. API reference
  3. SSL

Choose which certificate the edge serves

posthttps://api.nsin.ir/domains/{domain}/ssl/certificates/{certificateId}/select

Auth: Authorization: Bearer nsin_… or X-Api-Key: nsin_… — see API keys.

Makes this certificate the one served, for every hostname of the domain it covers. Hostnames it does not cover keep whatever they were serving. Edge nodes are told to drop the affected hostnames immediately, so the change is live within seconds.

Selecting the certificate NSIN manages (managed: true) returns the hostname to automatic: each renewal is served as soon as it is issued. Selecting an uploaded one pins it — renewals keep running underneath and stay available to switch back to, but they are not served while the pin is in place. Requires ssl.manage.

Path parameters

  • domainstringrequiredpath

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

  • certificateIdintegerrequiredpath

    The id of a certificate from GET /domains/{domain}/ssl/certificates.

Responses

200Selected. hostnames lists the names that changed over.

Content type: application/json

  • messagestring
  • hostnamesarray of string
json
{
  "message": "string",
  "hostnames": [
    "string"
  ]
}
400The certificate cannot serve: expired, no stored private key, not trusted, or it covers none of this domain's hostnames.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
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.

json
{
  "error": "invalid API key"
}
403The key is read-only, your role on the domain lacks the required permission, or the domain's plan does not include the feature.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "error": "read-only API key"
}
404No such certificate for this domain.

Content type: application/json

  • errorstringrequired

    Human-readable description of what went wrong.

json
{
  "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.

json
{
  "error": "rate limit exceeded"
}

Example request

bash
curl -X POST "https://api.nsin.ir/domains/example.com/ssl/certificates/0/select" \
  -H "Authorization: Bearer $NSIN_API_KEY"
esc