Digital Ocean CDN Endpoints API

Content hosted in DigitalOcean's object storage solution, [Spaces](https://docs.digitalocean.com/products/spaces/), can optionally be served by our globally distributed Content Delivery Network (CDN). By sending requests to `/v2/cdn/endpoints`, you can list, create, or delete CDN Endpoints as well as purge cached content. To use a custom subdomain to access the CDN Endpoint, provide the ID of a DigitalOcean managed TLS certificate and the fully qualified domain name for the custom subdomain. CDN endpoints have a rate limit of five requests per 10 seconds.

Business capability
IT Infrastructure Management BC-600.50

Operations 6

GET /v2/cdn/endpoints List All CDN Endpoints #
POST /v2/cdn/endpoints Create a New CDN Endpoint #
GET /v2/cdn/endpoints/{cdn_id} Retrieve an Existing CDN Endpoint #
PUT /v2/cdn/endpoints/{cdn_id} Update a CDN Endpoint #
DELETE /v2/cdn/endpoints/{cdn_id} Delete a CDN Endpoint #
DELETE /v2/cdn/endpoints/{cdn_id}/cache Purge the Cache for an Existing CDN Endpoint #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/digital-ocean-cdn-endpoints-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

digital-ocean-cdn-endpoints-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: DigitalOcean CDN Endpoints API
  version: '2.0'
  description: '# Introduction


    The DigitalOcean API allows you to manage Droplets and resources within the

    DigitalOcean cloud in a simple, programmatic way using conventional HTTP requests.'
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  contact:
    name: DigitalOcean API Team
    email: api-engineering@digitalocean.com
  termsOfService: https://www.digitalocean.com/legal/terms-of-service-agreement/
servers:
- url: https://api.digitalocean.com
  description: production
security:
- bearer_auth: []
tags:
- name: CDN Endpoints
  description: 'Content hosted in DigitalOcean''s object storage solution,

    Spaces,

    can optionally be served by our globally distributed Content Delivery

    Network (CDN).'
paths:
  /v2/cdn/endpoints:
    get:
      operationId: cdn_list_endpoints
      summary: List All CDN Endpoints
      description: To list all of the CDN endpoints available on your account, send a GET request to `/v2/cdn/endpoints`.
      tags:
      - CDN Endpoints
      parameters:
      - $ref: '#/components/parameters/per_page'
      - $ref: '#/components/parameters/page'
      responses:
        '200':
          $ref: '#/components/responses/all_cdn_endpoints'
        '401':
          $ref: '#/components/responses/unauthorized'
        '429':
          $ref: '#/components/responses/too_many_requests'
        '500':
          $ref: '#/components/responses/server_error'
        default:
          $ref: '#/components/responses/unexpected_error'
      x-codeSamples:
      - lang: cURL
        source: "curl -X GET \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n  \"https://api.digitalocean.com/v2/cdn/endpoints\""
      - lang: Go
        source: "import (\n    \"context\"\n    \"os\"\n\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n    client := godo.NewFromToken(token)\n    ctx := context.TODO()\n\n    opt := &godo.ListOptions{\n        Page:    1,\n        PerPage: 200,\n    }\n\n    cdns, _, err := client.CDNs.List(ctx, opt)\n}"
      - lang: Ruby
        source: 'require ''droplet_kit''

          token = ENV[''DIGITALOCEAN_TOKEN'']

          client = DropletKit::Client.new(access_token: token)


          cdns = client.cdns.all

          cdns.each'
      - lang: Python
        source: 'import os

          from pydo import Client


          client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))


          get_resp = client.cdn.list_endpoints()'
      security:
      - bearer_auth:
        - cdn:read
    post:
      operationId: cdn_create_endpoint
      summary: Create a New CDN Endpoint
      description: '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.'
      tags:
      - CDN Endpoints
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cdn_endpoint'
            examples:
              CDN Endpoint:
                value:
                  origin: static-images.nyc3.digitaloceanspaces.com
                  ttl: 3600
              CDN Endpoint With Custom Domain:
                value:
                  origin: static-images.nyc3.digitaloceanspaces.com
                  certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf
                  custom_domain: static.example.com
                  ttl: 3600
      responses:
        '201':
          $ref: '#/components/responses/existing_endpoint'
        '401':
          $ref: '#/components/responses/unauthorized'
        '429':
          $ref: '#/components/responses/too_many_requests'
        '500':
          $ref: '#/components/responses/server_error'
        default:
          $ref: '#/components/responses/unexpected_error'
      x-codeSamples:
      - lang: cURL
        source: "curl -X POST \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n  -d '{\"origin\": \"static-images.nyc3.digitaloceanspaces.com\",\"certificate_id\": \"892071a0-bb95-49bc-8021-3afd67a210bf\",\"custom_domain\": \"static.example.com\",\"ttl\": 3600}' \\\n  \"https://api.digitalocean.com/v2/cdn/endpoints\""
      - lang: Go
        source: "import (\n    \"context\"\n    \"os\"\n\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n    client := godo.NewFromToken(token)\n    ctx := context.TODO()\n\n    createRequest := &godo.CDNCreateRequest{\n        Origin:        \"static-images.nyc3.digitaloceanspaces.com\",\n        TTL:           3600,\n        CustomDomain:  \"static.example.com\",\n        CertificateID: \"892071a0-bb95-49bc-8021-3afd67a210b\",\n    }\n\n    cdn, _, err := client.CDNs.Create(ctx, createRequest)\n}"
      - lang: Ruby
        source: "require 'droplet_kit'\ntoken = ENV['DIGITALOCEAN_TOKEN']\nclient = DropletKit::Client.new(access_token: token)\n\ncdn = DropletKit::CDN.new(\n  origin: 'static-images.nyc3.digitaloceanspaces.com',\n  custom_domain: 'static.example.com',\n  certificate_id: '892071a0-bb95-49bc-8021-3afd67a210bf',\n  ttl: 3600\n)\n\nclient.cdns.create(cdn)"
      - lang: Python
        source: 'import os

          from pydo import Client


          client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))


          create_req = {"origin": "static-images.nyc3.digitaloceanspaces.com", "ttl": 3600}

          create_resp = client.cdn.create_endpoint(create_req)'
      security:
      - bearer_auth:
        - cdn:create
  /v2/cdn/endpoints/{cdn_id}:
    get:
      operationId: cdn_get_endpoint
      summary: Retrieve an Existing CDN Endpoint
      description: To show information about an existing CDN endpoint, send a GET request to `/v2/cdn/endpoints/$ENDPOINT_ID`.
      tags:
      - CDN Endpoints
      parameters:
      - $ref: '#/components/parameters/cdn_endpoint_id'
      responses:
        '200':
          $ref: '#/components/responses/existing_endpoint'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found'
        '429':
          $ref: '#/components/responses/too_many_requests'
        '500':
          $ref: '#/components/responses/server_error'
        default:
          $ref: '#/components/responses/unexpected_error'
      x-codeSamples:
      - lang: cURL
        source: "curl -X GET \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n  \"https://api.digitalocean.com/v2/cdn/endpoints/19f06b6a-3ace-4315-b086-499a0e521b76\""
      - lang: Go
        source: "import (\n    \"context\"\n    \"os\"\n\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n    client := godo.NewFromToken(token)\n    ctx := context.TODO()\n\n    cdn, _, err := client.CDNs.Get(ctx, \"19f06b6a-3ace-4315-b086-499a0e521b76\")\n}"
      - lang: Ruby
        source: 'require ''droplet_kit''

          token = ENV[''DIGITALOCEAN_TOKEN'']

          client = DropletKit::Client.new(access_token: token)


          client.cdns.find(id: ''19f06b6a-3ace-4315-b086-499a0e521b76'')'
      - lang: Python
        source: 'import os

          from pydo import Client


          client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))


          get_resp = client.cdn.get_endpoint(cdn_id="aa34ba1")'
      security:
      - bearer_auth:
        - cdn:read
    put:
      operationId: cdn_update_endpoints
      summary: Update a CDN Endpoint
      description: 'To update the TTL, certificate ID, or the FQDN of the custom subdomain for

        an existing CDN endpoint, send a PUT request to

        `/v2/cdn/endpoints/$ENDPOINT_ID`.'
      tags:
      - CDN Endpoints
      parameters:
      - $ref: '#/components/parameters/cdn_endpoint_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/update_endpoint'
      responses:
        '200':
          $ref: '#/components/responses/existing_endpoint'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found'
        '429':
          $ref: '#/components/responses/too_many_requests'
        '500':
          $ref: '#/components/responses/server_error'
        default:
          $ref: '#/components/responses/unexpected_error'
      x-codeSamples:
      - lang: cURL
        source: 'curl -X PUT \

          -H "Content-Type: application/json" \

          -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \

          -d ''{"ttl": 1800}'' \

          "https://api.digitalocean.com/v2/cdn/endpoints/19f06b6a-3ace-4315-b086-499a0e521b76" '
      - lang: Go
        source: "import (\n    \"context\"\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    pat := \"mytoken\"\n\n    client := godo.NewFromToken(pat)\n    ctx := context.TODO()\n\n    updateRequest := &godo.CDNUpdateTTLRequest{TTL: 1800}\n    cdn, _, err := client.CDNs.UpdateTTL(ctx, \"19f06b6a-3ace-4315-b086-499a0e521b76\", updateRequest)\n}"
      - lang: Ruby
        source: 'require ''droplet_kit''

          token = ''16f79fc8cd5adcfe528a0994311fa63cc877737b385b6ff7d12ed6684ba4fef5''

          client = DropletKit::Client.new(access_token: token)


          client.cdns.update_ttl(id: ''19f06b6a-3ace-4315-b086-499a0e521b76'', ttl: 1800)'
      - lang: Python
        source: "import os\nfrom pydo import Client\n\nclient = Client(token=os.environ.get(\"DIGITALOCEAN_TOKEN\"))\n\nupdate_req = {\n    \"ttl\": 3600,\n    \"certificate_id\": \"892071a0-bb95-49bc-8021-3afd67a210bf\",\n    \"custom_domain\": \"static.example.com\",\n}\n\nupdate_resp = client.cdn.update_endpoints(\"19f06b6a\", update_req)"
      security:
      - bearer_auth:
        - cdn:update
    delete:
      operationId: cdn_delete_endpoint
      summary: Delete a CDN Endpoint
      description: 'To delete a specific CDN endpoint, send a DELETE request to

        `/v2/cdn/endpoints/$ENDPOINT_ID`.


        A status of 204 will be given. This indicates that the request was processed

        successfully, but that no response body is needed.'
      tags:
      - CDN Endpoints
      parameters:
      - $ref: '#/components/parameters/cdn_endpoint_id'
      responses:
        '204':
          $ref: '#/components/responses/no_content'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found'
        '429':
          $ref: '#/components/responses/too_many_requests'
        '500':
          $ref: '#/components/responses/server_error'
        default:
          $ref: '#/components/responses/unexpected_error'
      x-codeSamples:
      - lang: cURL
        source: "curl -X DELETE \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n  \"https://api.digitalocean.com/v2/cdn/endpoints/19f06b6a-3ace-4315-b086-499a0e521b76\""
      - lang: Go
        source: "import (\n    \"context\"\n    \"os\"\n\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n    client := godo.NewFromToken(token)\n    ctx := context.TODO()\n\n    _, err := client.CDNs.Delete(ctx, \"19f06b6a-3ace-4315-b086-499a0e521b76\")\n}"
      - lang: Ruby
        source: 'require ''droplet_kit''

          token = ENV[''DIGITALOCEAN_TOKEN'']

          client = DropletKit::Client.new(access_token: token)


          client.cdns.delete(id: ''19f06b6a-3ace-4315-b086-499a0e521b76'')'
      - lang: Python
        source: 'import os

          from pydo import Client


          client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))


          delete_resp = client.cdn.delete_endpoint(cdn_id="bba23af")'
      security:
      - bearer_auth:
        - cdn:delete
  /v2/cdn/endpoints/{cdn_id}/cache:
    delete:
      operationId: cdn_purge_cache
      summary: Purge the Cache for an Existing CDN Endpoint
      description: 'To purge cached content from a CDN endpoint, send a DELETE request to

        `/v2/cdn/endpoints/$ENDPOINT_ID/cache`. The body of the request should include

        a `files` attribute containing a list of cached file paths to be purged. A

        path may be for a single file or may contain a wildcard (`*`) to recursively

        purge all files under a directory. When only a wildcard is provided, all cached

        files will be purged. There is a rate limit of 50 files per 20 seconds that can

        be purged. CDN endpoints have a rate limit of 5 requests per 10 seconds.

        Purging files using a wildcard path counts as a single request against the API''s

        rate limit. Two identical purge requests cannot be sent at the same time.'
      tags:
      - CDN Endpoints
      parameters:
      - $ref: '#/components/parameters/cdn_endpoint_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/purge_cache'
      responses:
        '204':
          $ref: '#/components/responses/no_content'
        '401':
          $ref: '#/components/responses/unauthorized'
        '404':
          $ref: '#/components/responses/not_found'
        '429':
          $ref: '#/components/responses/too_many_requests'
        '500':
          $ref: '#/components/responses/server_error'
        default:
          $ref: '#/components/responses/unexpected_error'
      x-codeSamples:
      - lang: cURL
        source: "curl -X DELETE \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $DIGITALOCEAN_TOKEN\" \\\n  -d '{\"files\": [\"assets/img/hero.png\",\"assets/css/*\"]}' \\\n  \"https://api.digitalocean.com/v2/cdn/endpoints/19f06b6a-3ace-4315-b086-499a0e521b76/cache\""
      - lang: Go
        source: "import (\n    \"context\"\n    \"os\"\n\n    \"github.com/digitalocean/godo\"\n)\n\nfunc main() {\n    token := os.Getenv(\"DIGITALOCEAN_TOKEN\")\n\n    client := godo.NewFromToken(token)\n    ctx := context.TODO()\n\n    flushRequest := &godo.CDNFlushCacheRequest{\n        Files: []string{\"assets/img/hero.png\",\"assets/css/*\"},\n    }\n\n    _, err := client.CDNs.FlushCache(ctx, \"19f06b6a-3ace-4315-b086-499a0e521b76\", flushRequest)\n}"
      - lang: Ruby
        source: "require 'droplet_kit'\ntoken = ENV['DIGITALOCEAN_TOKEN']\nclient = DropletKit::Client.new(access_token: token)\n\nclient.cdns.flush_cache(\n  id: '19f06b6a-3ace-4315-b086-499a0e521b76',\n  files: ['assets/img/hero.png','assets/css/*']\n)"
      - lang: Python
        source: 'import os

          from pydo import Client


          client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN"))


          purge_req = {"files": ["path/to/image.png", "path/to/css/*"]}


          purge_resp = client.cdn.purge_cache("19f06b6a", purge_req)'
      security:
      - bearer_auth:
        - cdn:delete
components:
  schemas:
    meta_properties:
      type: object
      description: Information about the response itself.
      properties:
        total:
          description: Number of objects returned by the request.
          type: integer
          example: 1
    link_to_last_page:
      type: object
      properties:
        last:
          description: URI of the last page of the results.
          type: string
          example: https://api.digitalocean.com/v2/images?page=2
    cdn_endpoint:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
          example: 892071a0-bb95-49bc-8021-3afd67a210bf
          description: A unique ID that can be used to identify and reference a CDN endpoint.
        origin:
          type: string
          format: hostname
          example: static-images.nyc3.digitaloceanspaces.com
          description: The fully qualified domain name (FQDN) for the origin server which provides the content for the CDN. This is currently restricted to a Space.
        endpoint:
          type: string
          format: hostname
          readOnly: true
          example: static-images.nyc3.cdn.digitaloceanspaces.com
          description: The fully qualified domain name (FQDN) from which the CDN-backed content is served.
        ttl:
          type: integer
          example: 3600
          enum:
          - 60
          - 600
          - 3600
          - 86400
          - 604800
          default: 3600
          description: 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.
        certificate_id:
          type: string
          format: uuid
          example: 892071a0-bb95-49bc-8021-3afd67a210bf
          description: The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
        custom_domain:
          type: string
          format: hostname
          example: static.example.com
          description: The fully qualified domain name (FQDN) of the custom subdomain used with the CDN endpoint.
        created_at:
          type: string
          format: date-time
          readOnly: true
          example: '2018-03-21T16:02:37Z'
          description: A time value given in ISO8601 combined date and time format that represents when the CDN endpoint was created.
      required:
      - origin
    error:
      type: object
      properties:
        id:
          description: 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."
          type: string
          example: not_found
        message:
          description: A message providing additional information about the error, including  details to help resolve it when possible.
          type: string
          example: The resource you were accessing could not be found.
        request_id:
          description: Optionally, some endpoints may include a request ID that should be  provided when reporting bugs or opening support tickets to help  identify the issue.
          type: string
          example: 4d9d8375-3c56-4925-a3e7-eb137fed17e9
      required:
      - id
      - message
    backward_links:
      allOf:
      - $ref: '#/components/schemas/link_to_first_page'
      - $ref: '#/components/schemas/link_to_prev_page'
    meta:
      type: object
      properties:
        meta:
          allOf:
          - $ref: '#/components/schemas/meta_properties'
          - required:
            - total
      required:
      - meta
    update_endpoint:
      type: object
      properties:
        ttl:
          type: integer
          example: 3600
          enum:
          - 60
          - 600
          - 3600
          - 86400
          - 604800
          default: 3600
          description: 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.
        certificate_id:
          type: string
          format: uuid
          example: 892071a0-bb95-49bc-8021-3afd67a210bf
          description: The ID of a DigitalOcean managed TLS certificate used for SSL when a custom subdomain is provided.
        custom_domain:
          type: string
          format: hostname
          example: static.example.com
          description: The fully qualified domain name (FQDN) of the custom subdomain used with the CDN endpoint.
    link_to_next_page:
      type: object
      properties:
        next:
          description: URI of the next page of the results.
          type: string
          example: https://api.digitalocean.com/v2/images?page=2
    pagination:
      type: object
      properties:
        links:
          $ref: '#/components/schemas/page_links'
    link_to_prev_page:
      type: object
      properties:
        prev:
          description: URI of the previous page of the results.
          type: string
          example: https://api.digitalocean.com/v2/images?page=1
    link_to_first_page:
      type: object
      properties:
        first:
          description: URI of the first page of the results.
          type: string
          example: https://api.digitalocean.com/v2/images?page=1
    forward_links:
      allOf:
      - $ref: '#/components/schemas/link_to_last_page'
      - $ref: '#/components/schemas/link_to_next_page'
    purge_cache:
      type: object
      properties:
        files:
          type: array
          items:
            type: string
          example:
          - path/to/image.png
          - path/to/css/*
          description: An array of strings containing the path to the content to be purged from the CDN cache.
      required:
      - files
    page_links:
      type: object
      properties:
        pages:
          anyOf:
          - $ref: '#/components/schemas/forward_links'
          - $ref: '#/components/schemas/backward_links'
          - {}
          example:
            pages:
              first: https://api.digitalocean.com/v2/account/keys?page=1
              prev: https://api.digitalocean.com/v2/account/keys?page=2
  responses:
    unexpected_error:
      description: Unexpected error
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: example_error
            message: some error message
    no_content:
      description: The action was successful and the response body is empty.
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
    not_found:
      description: The resource was not found.
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: not_found
            message: The resource you requested could not be found.
    too_many_requests:
      description: API Rate limit exceeded
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: too_many_requests
            message: API Rate limit exceeded.
    unauthorized:
      description: Unauthorized
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: unauthorized
            message: Unable to authenticate you.
    existing_endpoint:
      description: The response will be a JSON object with an `endpoint` key. This will be set to an object containing the standard CDN endpoint attributes.
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            properties:
              endpoint:
                $ref: '#/components/schemas/cdn_endpoint'
          examples:
            CDN Endpoint:
              value:
                endpoint:
                  id: 19f06b6a-3ace-4315-b086-499a0e521b76
                  origin: static-images.nyc3.digitaloceanspaces.com
                  endpoint: static-images.nyc3.cdn.digitaloceanspaces.com
                  created_at: '2018-07-19T15:04:16Z'
                  ttl: 3600
            CDN Endpoint With Custom Domain:
              value:
                endpoint:
                  id: 19f06b6a-3ace-4315-b086-499a0e521b76
                  origin: static-images.nyc3.digitaloceanspaces.com
                  endpoint: static-images.nyc3.cdn.digitaloceanspaces.com
                  created_at: '2018-07-19T15:04:16Z'
                  certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf
                  custom_domain: static.example.com
                  ttl: 3600
    all_cdn_endpoints:
      description: The result will be a JSON object with an `endpoints` key. This will be set to an array of endpoint objects, each of which will contain the standard CDN endpoint attributes.
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            allOf:
            - type: object
              properties:
                endpoints:
                  type: array
                  items:
                    $ref: '#/components/schemas/cdn_endpoint'
            - $ref: '#/components/schemas/pagination'
            - $ref: '#/components/schemas/meta'
            example:
              endpoints:
              - id: 19f06b6a-3ace-4315-b086-499a0e521b76
                origin: static-images.nyc3.digitaloceanspaces.com
                endpoint: static-images.nyc3.cdn.digitaloceanspaces.com
                created_at: '2018-07-19T15:04:16Z'
                certificate_id: 892071a0-bb95-49bc-8021-3afd67a210bf
                custom_domain: static.example.com
                ttl: 3600
              links: {}
              meta:
                total: 1
    server_error:
      description: Server error.
      headers:
        ratelimit-limit:
          $ref: '#/components/headers/ratelimit-limit'
        ratelimit-remaining:
          $ref: '#/components/headers/ratelimit-remaining'
        ratelimit-reset:
          $ref: '#/components/headers/ratelimit-reset'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/error'
          example:
            id: server_error
            message: Unexpected server-side error
  parameters:
    per_page:
      in: query
      name: per_page
      required: false
      description: Number of items returned per page
      schema:
        type: integer
        minimum: 1
        default: 20
        maximum: 200
      example: 2
    cdn_endpoint_id:
      in: path
      name: cdn_id
      description: A unique identifier for a CDN endpoint.
      required: true
      schema:
        type: string
        format: uuid
        minimum: 1
      example: 19f06b6a-3ace-4315-b086-499a0e521b76
    page:
      in: query
      name: page
      required: false
      description: Which 'page' of paginated results to return.
      schema:
        type: integer
        minimum: 1
        default: 1
      example: 1
  headers:
    ratelimit-reset:
      schema:
        type: integer
      example: 1444931833
      description: The time when the oldest request will expire. The value is given in Unix epoch time. See https://developers.digitalocean.com/documentation/v2/#rate-limit for information about how requests expire.
    ratelimit-remaining:
      schema:
        type: integer
      example: 4816
      description: The number of requests in your hourly quota that remain before you hit your request limit. See https://developers.digitalocean.com/documentation/v2/#rate-limit for information about how requests expire.
    ratelimit-limit:
      schema:
        type: integer
      example: 5000
      description: The default limit on number of requests that can be made per hour and per minute. Current rate limits are 5000 requests per hour and 250 requests per minute.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      description: '## OAuth Authentication


        In order to interact with the DigitalOcean API, you or your application must

        authenticate.


        The DigitalOcean API handles this through OAuth, an open standard for

        authorization. OAuth allows you to delegate access to your account.

        Scopes can be used to grant full access, read-only access, or access to

        a specific set of endpoints.


        You can generate an OAuth token by visiting the [Apps & API](https://cloud.digitalocean.com/account/api/tokens)

        section of the DigitalOcean control panel for your account.


        An OAuth token functions as a complete authentication request. In effect, it

        acts as a substitute for a username and password pair.


        Because of this, it is absolutely **essential** that you keep your OAuth

        tokens secure. In fact, upon generation, the web interface will only display

        each token a single time in order to prevent the token from being compromised.


        DigitalOcean access tokens begin with an identifiable prefix in order to

        distinguish them from other similar tokens.


        - `dop_v1_` for personal access tokens generated in the control panel

        - `doo_v1_` for tokens generated by applications using [the OAuth flow](https://docs.digitalocean.com/reference/api/oauth-api/)

        - `dor_v1_` for OAuth refresh tokens


        ### Scopes


        Scopes act like permissions assigned to an API token. These permissions

        determine what actions the token can perform. You can create API

        tokens that grant read-only access, full access, or limited access to

        specific endpoints by using custom scopes.


        Generally, scopes are designed to match HTTP verbs and common CRUD

        operations (Create, Read, Update, Delete).


        | HTTP Verb | CRUD Operation | Scope |

        |---|---|---|

        | GET | Read | `<resource>:read` |

        | POST | Create | `<resource>:create` |

        | PUT/PATCH | Update | `<resource>:update` |

        | DELETE | Delete | `<resource>:delete` |


        For example, creating a new Droplet by making a `POST` request to the

        `/v2/droplets` endpoint requires the `droplet:create` scope while

        listing Droplets by making a `GET` request to the `/v2/droplets`

        endpoint requires the `droplet:read` scope.


        Each endpoint below specifies which scope is required to access it when

        using custom scopes.


        ### How to Authenticate with OAuth


        In order to make an authenticated request, include a bearer-type

        `Authorization` header containing your OAuth token. All requests must be

        made over HTTPS.


        ### Authenticate with a Bearer Authorization Header


        ```

        curl -X $HTTP_METHOD -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" "https://api.digitalocean.com/v2/$OBJECT"

        ```

        '