Prefect Block documents API
Interact with a Workspace's Blocks.
Interact with a Workspace's Blocks.
openapi: 3.1.0
info:
title: Prefect Cloud Account Billing Block documents API
description: Prefect Cloud REST API documentation.
version: 0.8.4
tags:
- name: Block documents
description: Interact with a Workspace's Blocks.
externalDocs:
description: Securely store typed configuration
url: https://docs.prefect.io/v3/develop/blocks
paths:
/api/accounts/{account_id}/workspaces/{workspace_id}/block_types/slug/{slug}/block_documents:
get:
tags:
- Block documents
summary: Read Block Documents For Block Type
description: '
Required workspace scopes: `see_blocks`'
operationId: read_block_documents_for_block_type_api_accounts__account_id__workspaces__workspace_id__block_types_slug__slug__block_documents_get
parameters:
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace Id
- name: slug
in: path
required: true
schema:
type: string
description: The block type name
title: Slug
description: The block type name
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: include_secrets
in: query
required: false
schema:
type: boolean
description: Whether to include sensitive values in the block document.
default: false
title: Include Secrets
description: Whether to include sensitive values in the block document.
- 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:
type: array
items:
$ref: '#/components/schemas/BlockDocument'
title: Response Read Block Documents For Block Type Api Accounts Account Id Workspaces Workspace Id Block Types Slug Slug Block Documents Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_types/slug/{slug}/block_documents/name/{block_document_name}:
get:
tags:
- Block documents
summary: Read Block Document By Name For Block Type
description: '
Required workspace scopes: `see_blocks`'
operationId: read_block_document_by_name_for_block_type_api_accounts__account_id__workspaces__workspace_id__block_types_slug__slug__block_documents_name__block_document_name__get
parameters:
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace Id
- name: slug
in: path
required: true
schema:
type: string
description: The block type name
title: Slug
description: The block type name
- name: block_document_name
in: path
required: true
schema:
type: string
description: The block type name
title: Block Document Name
description: The block type name
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: include_secrets
in: query
required: false
schema:
type: boolean
description: Whether to include sensitive values in the block document.
default: false
title: Include Secrets
description: Whether to include sensitive values in the block document.
- 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/BlockDocument'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_documents/:
post:
tags:
- Block documents
summary: Create Block Document
description: 'Create a new block document.
Required workspace scopes: `manage_blocks`'
operationId: create_block_document_api_accounts__account_id__workspaces__workspace_id__block_documents__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/BlockDocumentCreate'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/BlockDocument'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
put:
tags:
- Block documents
summary: Create Or Update Block Document
description: '
Required workspace scopes: `manage_blocks`'
operationId: create_or_update_block_document_api_accounts__account_id__workspaces__workspace_id__block_documents__put
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/BlockDocumentCreate'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/BlockDocument'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_documents/filter:
post:
tags:
- Block documents
summary: Read Block Documents
description: 'Query for block documents.
Required workspace scopes: `see_blocks`'
operationId: read_block_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_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_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_filter_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/BlockDocument'
title: Response Read Block Documents Api Accounts Account Id Workspaces Workspace Id Block Documents Filter Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_documents/count:
post:
tags:
- Block documents
summary: Count Block Documents
description: 'Count block documents.
Required workspace scopes: `see_blocks`'
operationId: count_block_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_count_post
parameters:
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace 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_count_block_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_count_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: integer
title: Response Count Block Documents Api Accounts Account Id Workspaces Workspace Id Block Documents Count Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_documents/{id}:
get:
tags:
- Block documents
summary: Read Block Document By Id
description: '
Required workspace scopes: `see_blocks`'
operationId: read_block_document_by_id_api_accounts__account_id__workspaces__workspace_id__block_documents__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 document id
title: Id
description: The block document id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: include_secrets
in: query
required: false
schema:
type: boolean
description: Whether to include sensitive values in the block document.
default: false
title: Include Secrets
description: Whether to include sensitive values in the block document.
- 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/BlockDocument'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- Block documents
summary: Delete Block Document
description: '
Required workspace scopes: `manage_blocks`'
operationId: delete_block_document_api_accounts__account_id__workspaces__workspace_id__block_documents__id__delete
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The block document id
title: Id
description: The block document id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace 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'
patch:
tags:
- Block documents
summary: Update Block Document Data
description: '
Required workspace scopes: `manage_blocks`'
operationId: update_block_document_data_api_accounts__account_id__workspaces__workspace_id__block_documents__id__patch
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 document id
title: Id
description: The block document 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/BlockDocumentUpdate'
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_documents/{id}/access:
get:
tags:
- Block documents
summary: Read Block Document Access
description: 'Read access controls for a block_document.
Required workspace scopes: `see_blocks`'
operationId: read_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents__id__access_get
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The block_document id
title: Id
description: The block_document id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace 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/BlockDocumentAccessControl'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
put:
tags:
- Block documents
summary: Set Block Document Access
description: 'Set access controls for a block document.
The given access controls will replace any existing access controls.
Required workspace scopes: `manage_blocks`'
operationId: set_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents__id__access_put
parameters:
- name: id
in: path
required: true
schema:
type: string
format: uuid
description: The block_document id
title: Id
description: The block_document id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace 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/Body_set_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents__id__access_put'
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/block_documents/my-access:
post:
tags:
- Block documents
summary: Read Actors Block Document Access
description: 'Read access controls for a set of block documents and return the resolved
access levels for the current actor.
Required workspace scopes: `see_blocks`'
operationId: read_actors_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents_my_access_post
parameters:
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace 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/Body_read_actors_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents_my_access_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties:
type: array
items:
type: string
title: Response Read Actors Block Document Access Api Accounts Account Id Workspaces Workspace Id Block Documents My Access Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
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`
Body_count_block_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_count_post:
properties:
block_documents:
anyOf:
- $ref: '#/components/schemas/BlockDocumentFilter'
- type: 'null'
block_types:
anyOf:
- $ref: '#/components/schemas/BlockTypeFilter'
- type: 'null'
block_schemas:
anyOf:
- $ref: '#/components/schemas/BlockSchemaFilter'
- type: 'null'
type: object
title: Body_count_block_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_count_post
BlockDocumentCreate:
properties:
name:
anyOf:
- type: string
maxLength: 5000
- type: 'null'
title: Name
description: The block document's name. Not required for anonymous block documents.
data:
additionalProperties: true
type: object
title: Data
description: The block document's data
block_schema_id:
type: string
format: uuid
title: Block Schema Id
description: A block schema ID
block_type_id:
type: string
format: uuid
title: Block Type Id
description: A block type ID
is_anonymous:
type: boolean
title: Is Anonymous
description: Whether the block is anonymous (anonymous blocks are usually created by Prefect automatically)
default: false
additionalProperties: false
type: object
required:
- block_schema_id
- block_type_id
title: BlockDocumentCreate
description: Data used by the Prefect REST API to create a block document.
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
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.
BlockDocumentAccessControl:
properties:
manage_actors:
items:
$ref: '#/components/schemas/ObjectActorAccess'
type: array
title: Manage Actors
description: A list of actors with access to manage the block document.
view_actors:
items:
$ref: '#/components/schemas/ObjectActorAccess'
type: array
title: View Actors
description: A list of actors with access to view the block document.
type: object
title: BlockDocumentAccessControl
description: A representation of the access control for a block document.
BlockDocumentUpdate:
properties:
block_schema_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Block Schema Id
description: A block schema ID
data:
additionalProperties: true
type: object
title: Data
description: The block document's data
merge_existing_data:
type: boolean
title: Merge Existing Data
default: true
additionalProperties: false
type: object
title: BlockDocumentUpdate
description: Data used by the Prefect REST API to update a block document.
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`.
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
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
BlockDocumentFilterIsAnonymous:
properties:
eq_:
anyOf:
- type: boolean
- type: 'null'
title: Eq
description: Filter block documents for only those that are or are not anonymous.
additionalProperties: false
type: object
title: BlockDocumentFilterIsAnonymous
description: Filter by `BlockDocument.is_anonymous`.
BlockDocumentSort:
type: string
enum:
- NAME_DESC
- NAME_ASC
- BLOCK_TYPE_AND_NAME_ASC
title: BlockDocumentSort
description: Defines block document sorting options.
BlockTypeFilter:
properties:
name:
anyOf:
- $ref: '#/components/schemas/BlockTypeFilterName'
- type: 'null'
description: Filter criteria for `BlockType.name`
slug:
anyOf:
- $ref: '#/components/schemas/BlockTypeFilterSlug'
- type: 'null'
description: Filter criteria for `BlockType.slug`
additionalProperties: false
type: object
title: BlockTypeFilter
description: Filter BlockTypes
Body_read_block_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_filter_post:
properties:
block_documents:
anyOf:
- $ref: '#/components/schemas/BlockDocumentFilter'
- type: 'null'
block_types:
anyOf:
- $ref: '#/components/schemas/BlockTypeFilter'
- type: 'null'
block_schemas:
anyOf:
- $ref: '#/components/schemas/BlockSchemaFilter'
- type: 'null'
include_secrets:
type: boolean
title: Include Secrets
description: Whether to include sensitive values in the block document.
default: false
sort:
anyOf:
- $ref: '#/components/schemas/BlockDocumentSort'
- type: 'null'
default: NAME_ASC
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_documents_api_accounts__account_id__workspaces__workspace_id__block_documents_filter_post
Body_set_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents__id__access_put:
properties:
access_control:
$ref: '#/components/schemas/ReplaceBlockDocumentAccess'
type: object
required:
- access_control
title: Body_set_block_document_access_api_accounts__account_id__workspaces__workspace_id__block_documents__id__access_put
BlockDocument:
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:
anyOf:
- type: string
# --- truncated at 32 KB (40 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/prefect/refs/heads/main/openapi/prefect-block-documents-api-openapi.yml