POST/v2/cdn/endpoints

Create a New CDN Endpoint

To create a new CDN endpoint, send a POST request to /v2/cdn/endpoints. The origin attribute must be set to the fully qualified domain name (FQDN) of a DigitalOcean Space. Optionally, the TTL may be configured by setting the ttl attribute.

A custom subdomain may be configured by specifying the custom_domain and certificate_id attributes.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

7 body fields
idstringoptional
A unique ID that can be used to identify and reference a CDN endpoint.
originstringrequired
The fully qualified domain name (FQDN) for the origin server which provides the content for the CDN. This is currently restricted to a Space.
endpointstringoptional
The fully qualified domain name (FQDN) from which the CDN-backed content is served.
ttlintegeroptional
The amount of time the content is cached by the CDN's edge servers in seconds. TTL must be one of 60, 600, 3600, 86400, or 604800. Defaults to 3600 (one hour) when excluded.
Allowed:60600360086400604800Default:3600
certificate_idstringoptional
The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
custom_domainstringoptional
The fully qualified domain name (FQDN) of the custom subdomain used with the CDN endpoint.
created_atstringoptional
A time value given in ISO8601 combined date and time format that represents when the CDN endpoint was created.

5 status codes
201The response will be a JSON object with an `endpoint` key. This will be set to an object containing the standard CDN endpoint attributes.
endpointobjectoptional
401Authentication failed due to invalid credentials.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
429The API rate limit has been exceeded.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
500There was a server error.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.
defaultThere was an unexpected error.
idstringrequired
A short identifier corresponding to the HTTP status code returned. For example, the ID for a response returning a 404 status code would be "not_found."
messagestringrequired
A message providing additional information about the error, including details to help resolve it when possible.
request_idstringoptional
Optionally, some endpoints may include a request ID that should be provided when reporting bugs or opening support tickets to help identify the issue.

Error handling

A 401 is returned: Authentication failed due to invalid credentials. A 429 is returned: The API rate limit has been exceeded. A 500 is returned: There was a server error. Any other status is an error: There was an unexpected error.