Cloudflare Pages API

The Cloudflare Pages API enables developers to build automations and integrate Pages with their development workflow. It provides endpoints to manage projects, deployments, and builds, including creating deployments, rolling back, and configuring build settings.

OpenAPI Specification

cloudflare-pages-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Cloudflare Pages API
  description: >-
    The Cloudflare Pages API enables developers to build automations and
    integrate Pages with their development workflow. It provides endpoints
    to manage projects, deployments, and builds, including creating
    deployments, rolling back, and configuring build settings.
  version: '4.0'
  contact:
    name: Cloudflare Support
    url: https://support.cloudflare.com/
  termsOfService: https://www.cloudflare.com/terms/
externalDocs:
  description: Cloudflare Pages API Documentation
  url: https://developers.cloudflare.com/pages/configuration/api/
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4 Production Server
tags:
- name: Deployments
  description: >-
    Create, list, and manage deployments for Pages projects.
- name: Projects
  description: >-
    Manage Pages projects including creation, configuration, and deletion.
security:
- bearerAuth: []
paths:
  /accounts/{account_id}/pages/projects:
    get:
      operationId: listPagesProjects
      summary: Cloudflare List Pages Projects
      description: >-
        Returns a list of all Pages projects for the account.
      tags:
      - Projects
      parameters:
      - $ref: '#/components/parameters/AccountId'
      responses:
        '200':
          description: List of Pages projects.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectListResponse'
              examples:
                Listpagesprojects200Example:
                  summary: Default listPagesProjects 200 response
                  x-microcks-default: true
                  value:
                    result:
                    - id: abc123
                      name: Example Title
                      subdomain: example_value
                      domains: {}
                      production_branch: example_value
                      created_on: '2026-01-15T10:30:00Z'
                      build_config: {}
                    success: true
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createPagesProject
      summary: Cloudflare Create Pages Project
      description: >-
        Create a new Pages project with the specified build configuration
        and deployment settings.
      tags:
      - Projects
      parameters:
      - $ref: '#/components/parameters/AccountId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectInput'
            examples:
              CreatepagesprojectRequestExample:
                summary: Default createPagesProject request
                x-microcks-default: true
                value:
                  name: Example Title
                  production_branch: example_value
                  build_config:
                    build_command: example_value
                    destination_dir: example_value
                    root_dir: example_value
      responses:
        '200':
          description: Project created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectResponse'
              examples:
                Createpagesproject200Example:
                  summary: Default createPagesProject 200 response
                  x-microcks-default: true
                  value:
                    result:
                      id: abc123
                      name: Example Title
                      subdomain: example_value
                      domains:
                      - {}
                      production_branch: example_value
                      created_on: '2026-01-15T10:30:00Z'
                      build_config:
                        build_command: example_value
                        destination_dir: example_value
                        root_dir: example_value
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/pages/projects/{project_name}:
    get:
      operationId: getPagesProject
      summary: Cloudflare Get Pages Project
      description: >-
        Retrieve details of a specific Pages project.
      tags:
      - Projects
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      responses:
        '200':
          description: Project details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProjectResponse'
              examples:
                Getpagesproject200Example:
                  summary: Default getPagesProject 200 response
                  x-microcks-default: true
                  value:
                    result:
                      id: abc123
                      name: Example Title
                      subdomain: example_value
                      domains:
                      - {}
                      production_branch: example_value
                      created_on: '2026-01-15T10:30:00Z'
                      build_config:
                        build_command: example_value
                        destination_dir: example_value
                        root_dir: example_value
                    success: true
                    errors:
                    - {}
                    messages:
                    - {}
        '401':
          description: Unauthorized.
        '404':
          description: Project not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    patch:
      operationId: updatePagesProject
      summary: Cloudflare Update Pages Project
      description: >-
        Update the configuration of a Pages project.
      tags:
      - Projects
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProjectInput'
            examples:
              UpdatepagesprojectRequestExample:
                summary: Default updatePagesProject request
                x-microcks-default: true
                value:
                  name: Example Title
                  production_branch: example_value
                  build_config:
                    build_command: example_value
                    destination_dir: example_value
                    root_dir: example_value
      responses:
        '200':
          description: Project updated successfully.
        '401':
          description: Unauthorized.
        '404':
          description: Project not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deletePagesProject
      summary: Cloudflare Delete Pages Project
      description: >-
        Delete a Pages project and all its deployments.
      tags:
      - Projects
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      responses:
        '200':
          description: Project deleted successfully.
        '401':
          description: Unauthorized.
        '404':
          description: Project not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/pages/projects/{project_name}/deployments:
    get:
      operationId: listPagesDeployments
      summary: Cloudflare List Deployments
      description: >-
        Returns a list of all deployments for a Pages project.
      tags:
      - Deployments
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      responses:
        '200':
          description: List of deployments.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentListResponse'
              examples:
                Listpagesdeployments200Example:
                  summary: Default listPagesDeployments 200 response
                  x-microcks-default: true
                  value:
                    result:
                    - id: abc123
                      url: https://www.example.com
                      environment: production
                      created_on: '2026-01-15T10:30:00Z'
                      latest_stage: {}
                    success: true
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    post:
      operationId: createPagesDeployment
      summary: Cloudflare Create Deployment
      description: >-
        Create a new deployment for a Pages project by uploading assets or
        triggering a build from a connected repository.
      tags:
      - Deployments
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      responses:
        '200':
          description: Deployment created successfully.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}:
    get:
      operationId: getPagesDeployment
      summary: Cloudflare Get Deployment
      description: >-
        Retrieve details of a specific deployment including build status and
        deployment URL.
      tags:
      - Deployments
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      - $ref: '#/components/parameters/DeploymentId'
      responses:
        '200':
          description: Deployment details.
        '401':
          description: Unauthorized.
        '404':
          description: Deployment not found.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
    delete:
      operationId: deletePagesDeployment
      summary: Cloudflare Delete Deployment
      description: >-
        Delete a specific deployment.
      tags:
      - Deployments
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      - $ref: '#/components/parameters/DeploymentId'
      responses:
        '200':
          description: Deployment deleted successfully.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /accounts/{account_id}/pages/projects/{project_name}/deployments/{deployment_id}/rollback:
    post:
      operationId: rollbackPagesDeployment
      summary: Cloudflare Rollback Deployment
      description: >-
        Rollback the production deployment to a previous deployment.
      tags:
      - Deployments
      parameters:
      - $ref: '#/components/parameters/AccountId'
      - $ref: '#/components/parameters/ProjectName'
      - $ref: '#/components/parameters/DeploymentId'
      responses:
        '200':
          description: Rollback initiated successfully.
        '401':
          description: Unauthorized.
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API token with Pages permissions.
  parameters:
    AccountId:
      name: account_id
      in: path
      required: true
      description: The unique identifier of the Cloudflare account.
      schema:
        type: string
    ProjectName:
      name: project_name
      in: path
      required: true
      description: The name of the Pages project.
      schema:
        type: string
    DeploymentId:
      name: deployment_id
      in: path
      required: true
      description: The unique identifier of the deployment.
      schema:
        type: string
  schemas:
    Project:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the project.
          example: abc123
        name:
          type: string
          description: The name of the project.
          example: Example Title
        subdomain:
          type: string
          description: The subdomain for the project.
          example: example_value
        domains:
          type: array
          items:
            type: string
          description: Custom domains attached to the project.
          example: []
        production_branch:
          type: string
          description: The production branch name.
          example: example_value
        created_on:
          type: string
          format: date-time
          description: When the project was created.
          example: '2026-01-15T10:30:00Z'
        build_config:
          type: object
          properties:
            build_command:
              type: string
              description: The build command to run.
            destination_dir:
              type: string
              description: The output directory for build assets.
            root_dir:
              type: string
              description: The root directory of the project.
          example: example_value
    ProjectInput:
      type: object
      properties:
        name:
          type: string
          description: The name of the project.
          example: Example Title
        production_branch:
          type: string
          description: The production branch name.
          example: example_value
        build_config:
          type: object
          properties:
            build_command:
              type: string
            destination_dir:
              type: string
            root_dir:
              type: string
          example: example_value
    ProjectResponse:
      type: object
      properties:
        result:
          $ref: '#/components/schemas/Project'
        success:
          type: boolean
          example: true
        errors:
          type: array
          items:
            type: object
          example: []
        messages:
          type: array
          items:
            type: object
          example: []
    ProjectListResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/Project'
          example: []
        success:
          type: boolean
          example: true
    Deployment:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the deployment.
          example: abc123
        url:
          type: string
          format: uri
          description: The URL of the deployment.
          example: https://www.example.com
        environment:
          type: string
          enum:
          - production
          - preview
          description: The deployment environment.
          example: production
        created_on:
          type: string
          format: date-time
          description: When the deployment was created.
          example: '2026-01-15T10:30:00Z'
        latest_stage:
          type: object
          properties:
            name:
              type: string
            status:
              type: string
              enum:
              - idle
              - active
              - canceled
              - success
              - failure
          example: example_value
    DeploymentListResponse:
      type: object
      properties:
        result:
          type: array
          items:
            $ref: '#/components/schemas/Deployment'
          example: []
        success:
          type: boolean
          example: true