Add a domain to a service
A name under opnl.app works at once. Your own domain works once its DNS records are in place: a CNAME to edge.openpanel.sh and a TXT record that proves it is yours (both in the answer's records).
bearerAuthorizationBearer <token>An API key (opk_…) or a CLI token (opc_…).
serviceId*stringThe service's id.
Idempotency-Key?stringAny unique string up to 255 characters. Sending the same request again with it returns the first answer instead of creating twice.
length <= 255application/json- body
host*stringA name under opnl.app (shop.opnl.app) or your own domain (app.example.com).
length <= 253port?integerWhich HTTP port of the service it reaches. Default its first.
1 <= value <= 65535Add a domain to a service
application/json- response
id*stringuuidserviceId*stringuuidprojectId*stringuuidhost*stringkind*string"opnl""custom"port*integerverifyToken*string|nullverifiedAt*|nullcertificateSource*stringuploaded: the edge serves the certificate you uploaded for this domain.
"auto""uploaded"certificateExpiresAt*|When the uploaded certificate expires.
dnsZoneId*|The connected Cloudflare zone in which OpenPanel wrote this domain's records; null when you add them yourself.
dnsProblem*|Why OpenPanel could not write a record in that zone, such as a name that already has one.
createdAt*stringdate-timerecords*array<>For your own domain: the DNS records to add.
curl -X POST "https://openpanel.sh/api/v1/services/$SERVICE_ID/domains" \ -H "Authorization: Bearer $OPENPANEL_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "host": "string"}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "serviceId": "8f8bb40f-b96b-40fe-9064-5031fbe483f9", "projectId": "5a8591dd-4039-49df-9202-96385ba3eff8", "host": "string", "kind": "opnl", "port": 0, "verifyToken": "string", "verifiedAt": "2019-08-24T14:15:22Z", "certificateSource": "auto", "certificateExpiresAt": "2019-08-24T14:15:22Z", "dnsZoneId": "1f40467d-670b-4465-a735-818bec481113", "dnsProblem": "string", "createdAt": "2019-08-24T14:15:22Z", "records": [ { "type": "CNAME", "name": "string", "value": "string", "purpose": "string" } ]}