Cloudflare R2 Credential Management API

The Credential Management API from Cloudflare R2 — 1 operation(s) for credential management.

OpenAPI Specification

cloudflare-r2-credential-management-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Cloudflare R2 Cloudflare Buckets Credential Management API
  description: Cloudflare API endpoints for managing R2 object storage buckets, objects, CORS, lifecycle policies, custom domains, event notifications, data catalog, and temporary credentials.
  version: 4.0.0
  termsOfService: https://www.cloudflare.com/website-terms/
  contact:
    name: Cloudflare Developer Docs
    url: https://developers.cloudflare.com/r2/
servers:
- url: https://api.cloudflare.com/client/v4
  description: Cloudflare API v4
tags:
- name: Credential Management
paths:
  /accounts/{account_id}/r2-catalog/{bucket_name}/credential:
    post:
      description: 'Store authentication credentials for a catalog. These credentials are used

        to authenticate with R2 storage when performing catalog operations.

        '
      operationId: store-credentials
      parameters:
      - description: Identifies the account.
        in: path
        name: account_id
        required: true
        schema:
          $ref: '#/components/schemas/r2-data-catalog_account-id'
      - description: Specifies the R2 bucket name.
        in: path
        name: bucket_name
        required: true
        schema:
          $ref: '#/components/schemas/r2-data-catalog_bucket-name'
      requestBody:
        content:
          application/json:
            example:
              token: your-cloudflare-api-token-here
            schema:
              $ref: '#/components/schemas/r2-data-catalog_catalog-credential-request'
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                errors: []
                messages: []
                result: null
                success: true
              schema:
                allOf:
                - $ref: '#/components/schemas/r2-data-catalog_api-response-single'
                - properties:
                    result:
                      nullable: true
                      type: object
                  type: object
          description: Credentials stored successfully.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
          description: Bad request.
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
          description: Authentication failed.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
          description: Forbidden.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
          description: Catalog not found.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/r2-data-catalog_api-response-common-failure'
          description: Internal server error.
      security:
      - api_token: []
      - api_email: []
        api_key: []
      summary: Store catalog credentials
      tags:
      - Credential Management
      x-api-token-group:
      - Workers R2 Data Catalog Write
components:
  schemas:
    r2-data-catalog_api-response-errors:
      description: Contains errors if the API call was unsuccessful.
      items:
        properties:
          code:
            description: Specifies the error code.
            type: integer
          message:
            description: Describes the error.
            type: string
        required:
        - code
        - message
        type: object
      type: array
    r2-data-catalog_api-response-success:
      description: Indicates whether the API call was successful.
      example: true
      type: boolean
    r2-data-catalog_api-response-messages:
      description: Contains informational messages.
      items:
        properties:
          code:
            description: Specifies the message code.
            type: integer
          message:
            description: Contains the message text.
            type: string
        required:
        - code
        - message
        type: object
      type: array
    r2-data-catalog_api-response-common-failure:
      properties:
        errors:
          items:
            properties:
              code:
                type: integer
              message:
                type: string
            type: object
          minItems: 1
          type: array
        messages:
          items:
            type: object
          type: array
        success:
          enum:
          - false
          type: boolean
      type: object
    r2-data-catalog_bucket-name:
      description: Specifies the R2 bucket name.
      example: my-data-bucket
      maxLength: 63
      minLength: 3
      pattern: ^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$
      type: string
    r2-data-catalog_account-id:
      description: Use this to identify the account.
      example: 0123456789abcdef0123456789abcdef
      pattern: ^[a-fA-F0-9]{32}$
      type: string
    r2-data-catalog_api-response-single:
      properties:
        errors:
          $ref: '#/components/schemas/r2-data-catalog_api-response-errors'
        messages:
          $ref: '#/components/schemas/r2-data-catalog_api-response-messages'
        success:
          $ref: '#/components/schemas/r2-data-catalog_api-response-success'
      required:
      - success
      - errors
      - messages
      type: object
    r2-data-catalog_catalog-credential-request:
      description: Contains request to store catalog credentials.
      properties:
        token:
          description: Provides the Cloudflare API token for accessing R2.
          example: your-cloudflare-api-token-here
          type: string
      required:
      - token
      type: object
  securitySchemes:
    api_email:
      in: header
      name: X-Auth-Email
      type: apiKey
    api_key:
      in: header
      name: X-Auth-Key
      type: apiKey
    api_token:
      scheme: bearer
      type: http
    user_service_key:
      in: header
      name: X-Auth-User-Service-Key
      type: apiKey