Gcore CDN API

Content delivery network resources, rules, origin groups, and purge.

OpenAPI Specification

gcore-cdn-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Gcore CDN API
  description: 'Partial OpenAPI description of the Gcore edge cloud platform REST API, covering representative documented endpoints across CDN, Cloud (compute), Object Storage, DNS, Streaming, Everywhere Inference (edge AI), WAAP security, and FastEdge. All services share a single host, https://api.gcore.com, and authenticate with a permanent API token sent as "Authorization: APIKey <token>".'
  termsOfService: https://gcore.com/legal/lsa
  contact:
    name: Gcore Support
    url: https://gcore.com/support
    email: support@gcore.com
  version: '1.0'
servers:
- url: https://api.gcore.com
  description: Gcore unified API host
security:
- APIKey: []
tags:
- name: CDN
  description: Content delivery network resources, rules, origin groups, and purge.
paths:
  /cdn/resources:
    get:
      operationId: listCdnResources
      tags:
      - CDN
      summary: List CDN resources
      description: Returns the list of CDN resources for the account.
      parameters:
      - name: deleted
        in: query
        required: false
        schema:
          type: boolean
        description: Filter by deletion status.
      - name: status
        in: query
        required: false
        schema:
          type: string
          enum:
          - active
          - suspended
          - processed
      responses:
        '200':
          description: A list of CDN resources.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CdnResource'
        '401':
          $ref: '#/components/responses/Unauthorized'
    post:
      operationId: createCdnResource
      tags:
      - CDN
      summary: Create CDN resource
      description: Creates a new CDN resource bound to a primary delivery domain (cname).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CdnResourceCreate'
      responses:
        '201':
          description: The created CDN resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CdnResource'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
  /cdn/resources/{resource_id}:
    get:
      operationId: getCdnResource
      tags:
      - CDN
      summary: Get CDN resource details
      parameters:
      - $ref: '#/components/parameters/ResourceId'
      responses:
        '200':
          description: CDN resource details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CdnResource'
        '404':
          $ref: '#/components/responses/NotFound'
    put:
      operationId: updateCdnResource
      tags:
      - CDN
      summary: Update CDN resource
      parameters:
      - $ref: '#/components/parameters/ResourceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CdnResourceCreate'
      responses:
        '200':
          description: The updated CDN resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CdnResource'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: deleteCdnResource
      tags:
      - CDN
      summary: Delete CDN resource
      parameters:
      - $ref: '#/components/parameters/ResourceId'
      responses:
        '204':
          description: CDN resource deleted.
        '404':
          $ref: '#/components/responses/NotFound'
  /cdn/resources/{resource_id}/rules:
    get:
      operationId: listCdnRules
      tags:
      - CDN
      summary: List CDN resource rules
      parameters:
      - $ref: '#/components/parameters/ResourceId'
      responses:
        '200':
          description: A list of rules for the resource.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CdnRule'
    post:
      operationId: createCdnRule
      tags:
      - CDN
      summary: Create CDN resource rule
      description: Creates a rule that applies custom caching, delivery, and security options to a path pattern within the CDN resource.
      parameters:
      - $ref: '#/components/parameters/ResourceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CdnRuleCreate'
      responses:
        '201':
          description: The created rule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CdnRule'
  /cdn/resources/{resource_id}/purge:
    post:
      operationId: purgeCdnResource
      tags:
      - CDN
      summary: Purge CDN cache
      description: Purges content from CDN edge caches for the resource. Supply specific URLs, path patterns, or omit both to purge all cache.
      parameters:
      - $ref: '#/components/parameters/ResourceId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PurgeRequest'
      responses:
        '201':
          description: Purge request accepted.
        '429':
          $ref: '#/components/responses/RateLimited'
  /cdn/public-ip-list:
    get:
      operationId: getCdnPublicIpList
      tags:
      - CDN
      summary: Get CDN edge server IP list
      description: Returns IP addresses of CDN servers used to pull content from origins.
      responses:
        '200':
          description: List of edge server IP ranges.
          content:
            application/json:
              schema:
                type: object
                properties:
                  addresses:
                    type: array
                    items:
                      type: string
                  addresses_v6:
                    type: array
                    items:
                      type: string
components:
  parameters:
    ResourceId:
      name: resource_id
      in: path
      required: true
      schema:
        type: integer
      description: CDN resource identifier.
  schemas:
    CdnRule:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        rule:
          type: string
          description: Path pattern the rule applies to (regular expression).
        ruleType:
          type: integer
        originGroup:
          type: integer
        options:
          type: object
          additionalProperties: true
    CdnRuleCreate:
      type: object
      required:
      - rule
      - ruleType
      properties:
        name:
          type: string
        rule:
          type: string
        ruleType:
          type: integer
        originGroup:
          type: integer
        options:
          type: object
          additionalProperties: true
    CdnResource:
      type: object
      properties:
        id:
          type: integer
        cname:
          type: string
          description: Primary delivery domain for the resource.
        active:
          type: boolean
        status:
          type: string
        origin:
          type: string
        originGroup:
          type: integer
        sslData:
          type: integer
          nullable: true
          description: SSL certificate identifier.
        rules:
          type: array
          items:
            $ref: '#/components/schemas/CdnRule'
    PurgeRequest:
      type: object
      properties:
        urls:
          type: array
          items:
            type: string
          description: Up to 100 absolute URLs to purge.
        paths:
          type: array
          items:
            type: string
          description: Up to 10 path patterns to purge.
    Error:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    CdnResourceCreate:
      type: object
      required:
      - cname
      properties:
        cname:
          type: string
        origin:
          type: string
          description: Origin server hostname or IP.
        originGroup:
          type: integer
        sslData:
          type: integer
        options:
          type: object
          additionalProperties: true
  responses:
    Unauthorized:
      description: Missing or invalid API token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: The request was malformed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: Rate limit exceeded for this operation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    APIKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'Permanent API token sent as "Authorization: APIKey <token>". The header name is case-insensitive.'