Prefect Block schemas API

Interact with a Workspace's Block schemas.

OpenAPI Specification

prefect-block-schemas-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prefect Cloud Account Billing Block schemas API
  description: Prefect Cloud REST API documentation.
  version: 0.8.4
tags:
- name: Block schemas
  description: Interact with a Workspace's Block schemas.
  externalDocs:
    description: Securely store typed configuration
    url: https://docs.prefect.io/v3/develop/blocks
paths:
  /api/accounts/{account_id}/workspaces/{workspace_id}/block_schemas/:
    post:
      tags:
      - Block schemas
      summary: Create Block Schema
      description: '


        Required workspace scopes: `manage_blocks`'
      operationId: create_block_schema_api_accounts__account_id__workspaces__workspace_id__block_schemas__post
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: x-prefect-api-version
        in: header
        required: false
        schema:
          type: string
          title: X-Prefect-Api-Version
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BlockSchemaCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/block_schemas/{id}:
    delete:
      tags:
      - Block schemas
      summary: Delete Block Schema
      description: 'Delete a block schema by id.


        Required workspace scopes: `manage_blocks`'
      operationId: delete_block_schema_api_accounts__account_id__workspaces__workspace_id__block_schemas__id__delete
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          description: The block schema id
          title: Id
        description: The block schema id
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: x-prefect-api-version
        in: header
        required: false
        schema:
          type: string
          title: X-Prefect-Api-Version
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    get:
      tags:
      - Block schemas
      summary: Read Block Schema By Id
      description: 'Get a block schema by id.


        Required workspace scopes: `see_blocks`'
      operationId: read_block_schema_by_id_api_accounts__account_id__workspaces__workspace_id__block_schemas__id__get
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          description: The block schema id
          title: Id
        description: The block schema id
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: x-prefect-api-version
        in: header
        required: false
        schema:
          type: string
          title: X-Prefect-Api-Version
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/block_schemas/filter:
    post:
      tags:
      - Block schemas
      summary: Read Block Schemas
      description: 'Read all block schemas, optionally filtered by type


        Required workspace scopes: `see_blocks`'
      operationId: read_block_schemas_api_accounts__account_id__workspaces__workspace_id__block_schemas_filter_post
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: x-prefect-api-version
        in: header
        required: false
        schema:
          type: string
          title: X-Prefect-Api-Version
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_read_block_schemas_api_accounts__account_id__workspaces__workspace_id__block_schemas_filter_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BlockSchema'
                title: Response Read Block Schemas Api Accounts  Account Id  Workspaces  Workspace Id  Block Schemas Filter Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/block_schemas/checksum/{checksum}:
    get:
      tags:
      - Block schemas
      summary: Read Block Schema By Checksum
      description: '


        Required workspace scopes: `see_blocks`'
      operationId: read_block_schema_by_checksum_api_accounts__account_id__workspaces__workspace_id__block_schemas_checksum__checksum__get
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Workspace Id
      - name: checksum
        in: path
        required: true
        schema:
          type: string
          description: The block schema checksum
          title: Checksum
        description: The block schema checksum
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: version
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Version of block schema. If not provided the most recently created block schema with the matching checksum will be returned.
          title: Version
        description: Version of block schema. If not provided the most recently created block schema with the matching checksum will be returned.
      - name: x-prefect-api-version
        in: header
        required: false
        schema:
          type: string
          title: X-Prefect-Api-Version
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BlockSchema'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    BlockSchemaFilterCapabilities:
      properties:
        all_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: All
          description: A list of block capabilities. Block entities will be returned only if an associated block schema has a superset of the defined capabilities.
          examples:
          - - write-storage
            - read-storage
      additionalProperties: false
      type: object
      title: BlockSchemaFilterCapabilities
      description: Filter by `BlockSchema.capabilities`
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    BlockSchemaFilterId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: A list of IDs to include
      additionalProperties: false
      type: object
      title: BlockSchemaFilterId
      description: Filter by BlockSchema.id
    prefect_cloud__orion__schemas__filters__Operator:
      type: string
      enum:
      - and_
      - or_
      title: Operator
      description: Operators for combining filter criteria.
    Body_read_block_schemas_api_accounts__account_id__workspaces__workspace_id__block_schemas_filter_post:
      properties:
        block_schemas:
          anyOf:
          - $ref: '#/components/schemas/BlockSchemaFilter'
          - type: 'null'
        offset:
          type: integer
          minimum: 0.0
          title: Offset
          default: 0
        limit:
          type: integer
          title: Limit
          description: Defaults to PREFECT_ORION_API_DEFAULT_LIMIT if not provided.
      type: object
      title: Body_read_block_schemas_api_accounts__account_id__workspaces__workspace_id__block_schemas_filter_post
    BlockSchemaFilter:
      properties:
        operator:
          $ref: '#/components/schemas/prefect_cloud__orion__schemas__filters__Operator'
          description: Operator for combining filter criteria. Defaults to 'and_'.
          default: and_
        block_type_id:
          anyOf:
          - $ref: '#/components/schemas/BlockSchemaFilterBlockTypeId'
          - type: 'null'
          description: Filter criteria for `BlockSchema.block_type_id`
        block_capabilities:
          anyOf:
          - $ref: '#/components/schemas/BlockSchemaFilterCapabilities'
          - type: 'null'
          description: Filter criteria for `BlockSchema.capabilities`
        id:
          anyOf:
          - $ref: '#/components/schemas/BlockSchemaFilterId'
          - type: 'null'
          description: Filter criteria for `BlockSchema.id`
        version:
          anyOf:
          - $ref: '#/components/schemas/BlockSchemaFilterVersion'
          - type: 'null'
          description: Filter criteria for `BlockSchema.version`
      additionalProperties: false
      type: object
      title: BlockSchemaFilter
      description: Filter BlockSchemas
    BlockSchema:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Created
        updated:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated
        checksum:
          type: string
          title: Checksum
          description: The block schema's unique checksum
        fields:
          additionalProperties: true
          type: object
          title: Fields
          description: The block schema's field schema
        block_type_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Block Type Id
          description: A block type ID
        block_type:
          anyOf:
          - $ref: '#/components/schemas/BlockType'
          - type: 'null'
          description: The associated block type
        capabilities:
          items:
            type: string
          type: array
          title: Capabilities
          description: A list of Block capabilities
        version:
          type: string
          title: Version
          description: Human readable identifier for the block schema
          default: non-versioned
      type: object
      required:
      - checksum
      - block_type_id
      title: BlockSchema
      description: An ORM representation of a block schema.
    BlockSchemaFilterVersion:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: A list of block schema versions.
          examples:
          - - 2.0.0
            - 2.1.0
      additionalProperties: false
      type: object
      title: BlockSchemaFilterVersion
      description: Filter by `BlockSchema.capabilities`
    BlockSchemaFilterBlockTypeId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: A list of block type ids to include
      additionalProperties: false
      type: object
      title: BlockSchemaFilterBlockTypeId
      description: Filter by `BlockSchema.block_type_id`.
    BlockSchemaCreate:
      properties:
        fields:
          additionalProperties: true
          type: object
          title: Fields
          description: The block schema's field schema
        block_type_id:
          type: string
          format: uuid
          title: Block Type Id
          description: A block type ID
        capabilities:
          items:
            type: string
          type: array
          title: Capabilities
          description: A list of Block capabilities
        version:
          type: string
          maxLength: 5000
          title: Version
          description: Human readable identifier for the block schema
          default: non-versioned
      additionalProperties: false
      type: object
      required:
      - block_type_id
      title: BlockSchemaCreate
      description: Data used by the Prefect REST API to create a block schema.
    BlockType:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        created:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Created
        updated:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Updated
        name:
          type: string
          pattern: ^[^/%&><]+$
          title: Name
          description: A block type's name
        slug:
          type: string
          title: Slug
          description: A block type's slug
        logo_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Logo Url
          description: Web URL for the block type's logo
        documentation_url:
          anyOf:
          - type: string
          - type: 'null'
          title: Documentation Url
          description: Web URL for the block type's documentation
        description:
          anyOf:
          - type: string
          - type: 'null'
          title: Description
          description: A short blurb about the corresponding block's intended use
        code_example:
          anyOf:
          - type: string
          - type: 'null'
          title: Code Example
          description: A code snippet demonstrating use of the corresponding block
        is_protected:
          type: boolean
          title: Is Protected
          description: Protected block types cannot be modified via API.
          default: false
      type: object
      required:
      - name
      - slug
      title: BlockType
      description: An ORM representation of a block type