Cloudflare Durable Objects API

Cloudflare Durable Objects combine compute with persistent storage in a single Worker. The API provides transactional and strongly consistent storage with support for SQL, key-value, alarms, and WebSocket hibernation for building stateful serverless applications.

OpenAPI Specification

cloudflare-durable-objects-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Cloudflare Durable Objects API
  description: >-
    Cloudflare Durable Objects combine compute with persistent storage in a
    single Worker. The management API provides endpoints for listing and
    managing Durable Object namespaces and individual objects within those
    namespaces, enabling developers to build stateful serverless applications.
  version: '4.0'
  contact:
    name: Cloudflare Support
    url: https://support.cloudflare.com/
  termsOfService: https://www.cloudflare.com/terms/
externalDocs:
  description: Cloudflare Durable Objects Documentation
  url: https://developers.cloudflare.com/durable-objects/
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4 Production Server
tags:
- name: Namespaces
  description: >-
    Manage Durable Object namespaces that group related object instances.
- name: Objects
  description: >-
    List and manage individual Durable Object instances within a namespace.
security:
- bearerAuth: []
paths:
  /accounts/{account_id}/workers/durable_objects/namespaces:
    get:
      operationId: listDurableObjectNamespaces
      summary: Cloudflare List Durable Object Namespaces
      description: >-
        Returns all Durable Object namespaces for the account.
      tags:
      - Namespaces
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: List of Durable Object namespaces.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NamespaceListResponse'
              examples:
                Listdurableobjectnamespaces200Example:
                  summary: Default listDurableObjectNamespaces 200 response
                  x-microcks-default: true
                  value:
                    result:
                    - id: abc123
                      name: Example Title
                      script: example_value
                      class: example_value
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/workers/durable_objects/namespaces/{namespace_id}/objects:
    get:
      operationId: listDurableObjects
      summary: Cloudflare List Durable Objects
      description: >-
        Returns a list of Durable Objects within a namespace with cursor-based
        pagination.
      tags:
      - Objects
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/NamespaceId'
      - name: cursor
        in: query
        description: Cursor for pagination.
        schema:
          type: string
        example: example_value
      - name: limit
        in: query
        description: Maximum number of objects to return.
        schema:
          type: integer
        example: 10
      responses:
        '200':
          description: List of Durable Objects.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API token with Workers permissions.
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: The unique identifier of the Cloudflare account.
      schema:
        type: string
    NamespaceId:
      name: namespace_id
      in: path
      required: true
      description: The unique identifier of the Durable Object namespace.
      schema:
        type: string
  schemas:
    DurableObjectNamespace:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the namespace.
          example: abc123
        name:
          type: string
          description: The name of the namespace.
          example: Example Title
        script:
          type: string
          description: The Worker script associated with the namespace.
          example: example_value
        class:
          type: string
          description: The Durable Object class name.
          example: example_value
    NamespaceListResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/DurableObjectNamespace'
          example: []
        success:
          type: boolean
          example: true
        errors:
          type: array
          items:
            type: object
          example: []
        messages:
          type: array
          items:
            type: object
          example: []