Prefect Variables API

The Variables API from Prefect — 5 operation(s) for variables.

OpenAPI Specification

prefect-variables-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prefect Cloud Account Billing Variables API
  description: Prefect Cloud REST API documentation.
  version: 0.8.4
tags:
- name: Variables
paths:
  /api/accounts/{account_id}/workspaces/{workspace_id}/variables/:
    post:
      tags:
      - Variables
      summary: Create Variable
      description: '


        Required workspace scopes: `write_variables`'
      operationId: create_variable_api_accounts__account_id__workspaces__workspace_id__variables__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/VariableCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Variable'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/variables/{id}:
    get:
      tags:
      - Variables
      summary: Read Variable
      description: '


        Required workspace scopes: `see_variables`'
      operationId: read_variable_api_accounts__account_id__workspaces__workspace_id__variables__id__get
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: 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/Variable'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Variables
      summary: Update Variable
      description: '


        Required workspace scopes: `write_variables`'
      operationId: update_variable_api_accounts__account_id__workspaces__workspace_id__variables__id__patch
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: 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/VariableUpdate'
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Variables
      summary: Delete Variable
      description: '


        Required workspace scopes: `manage_variables`'
      operationId: delete_variable_api_accounts__account_id__workspaces__workspace_id__variables__id__delete
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: 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'
  /api/accounts/{account_id}/workspaces/{workspace_id}/variables/name/{name}:
    get:
      tags:
      - Variables
      summary: Read Variable By Name
      description: '


        Required workspace scopes: `see_variables`'
      operationId: read_variable_by_name_api_accounts__account_id__workspaces__workspace_id__variables_name__name__get
      parameters:
      - name: name
        in: path
        required: true
        schema:
          type: string
          title: Name
      - 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/Variable'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    patch:
      tags:
      - Variables
      summary: Update Variable By Name
      description: '


        Required workspace scopes: `write_variables`'
      operationId: update_variable_by_name_api_accounts__account_id__workspaces__workspace_id__variables_name__name__patch
      parameters:
      - name: name
        in: path
        required: true
        schema:
          type: string
          title: Name
      - 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/VariableUpdate'
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Variables
      summary: Delete Variable By Name
      description: '


        Required workspace scopes: `manage_variables`'
      operationId: delete_variable_by_name_api_accounts__account_id__workspaces__workspace_id__variables_name__name__delete
      parameters:
      - name: name
        in: path
        required: true
        schema:
          type: string
          title: Name
      - 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'
  /api/accounts/{account_id}/workspaces/{workspace_id}/variables/filter:
    post:
      tags:
      - Variables
      summary: Read Variables
      description: '


        Required workspace scopes: `see_variables`'
      operationId: read_variables_api_accounts__account_id__workspaces__workspace_id__variables_filter_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_read_variables_api_accounts__account_id__workspaces__workspace_id__variables_filter_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Variable'
                title: Response Read Variables Api Accounts  Account Id  Workspaces  Workspace Id  Variables Filter Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/variables/count:
    post:
      tags:
      - Variables
      summary: Count Variables
      description: '


        Required workspace scopes: `see_variables`'
      operationId: count_variables_api_accounts__account_id__workspaces__workspace_id__variables_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_variables_api_accounts__account_id__workspaces__workspace_id__variables_count_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: integer
                title: Response Count Variables Api Accounts  Account Id  Workspaces  Workspace Id  Variables Count Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    VariableCreate:
      properties:
        name:
          type: string
          maxLength: 255
          title: Name
          description: The name of the variable
          examples:
          - my_variable
        value:
          anyOf:
          - type: string
          - type: integer
          - type: number
          - type: boolean
          - additionalProperties: true
            type: object
          - items: {}
            type: array
          - type: 'null'
          title: Value
          description: The value of the variable
          examples:
          - my-value
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: A list of variable tags
          examples:
          - - tag-1
            - tag-2
      additionalProperties: false
      type: object
      required:
      - name
      - value
      title: VariableCreate
      description: Data used by the Orion API to create a Variable.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Variable:
      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
          maxLength: 255
          title: Name
          description: The name of the variable
          examples:
          - my_variable
        value:
          anyOf:
          - type: string
          - type: integer
          - type: number
          - type: boolean
          - additionalProperties: true
            type: object
          - items: {}
            type: array
          - type: 'null'
          title: Value
          description: The value of the variable
          examples:
          - my-value
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: A list of variable tags
          examples:
          - - tag-1
            - tag-2
      type: object
      required:
      - name
      - value
      title: Variable
    VariableFilterTags:
      properties:
        operator:
          $ref: '#/components/schemas/prefect_cloud__orion__schemas__filters__Operator'
          description: Operator for combining filter criteria. Defaults to 'and_'.
          default: and_
        all_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: All
          description: A list of tags. Variables will be returned only if their tags are a superset of the list
          examples:
          - - tag-1
            - tag-2
        is_null_:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Is Null
          description: If true, only include Variables without tags
      additionalProperties: false
      type: object
      title: VariableFilterTags
      description: Filter by `Variable.tags`.
    Body_read_variables_api_accounts__account_id__workspaces__workspace_id__variables_filter_post:
      properties:
        offset:
          type: integer
          minimum: 0.0
          title: Offset
          default: 0
        variables:
          anyOf:
          - $ref: '#/components/schemas/VariableFilter'
          - type: 'null'
        sort:
          $ref: '#/components/schemas/VariableSort'
          default: NAME_ASC
        limit:
          type: integer
          title: Limit
          description: Defaults to PREFECT_ORION_API_DEFAULT_LIMIT if not provided.
      type: object
      title: Body_read_variables_api_accounts__account_id__workspaces__workspace_id__variables_filter_post
    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
    VariableFilter:
      properties:
        operator:
          $ref: '#/components/schemas/prefect_cloud__orion__schemas__filters__Operator'
          description: Operator for combining filter criteria. Defaults to 'and_'.
          default: and_
        id:
          anyOf:
          - $ref: '#/components/schemas/VariableFilterId'
          - type: 'null'
          description: Filter criteria for `Variable.id`
        name:
          anyOf:
          - $ref: '#/components/schemas/VariableFilterName'
          - type: 'null'
          description: Filter criteria for `Variable.name`
        value:
          anyOf:
          - $ref: '#/components/schemas/VariableFilterValue'
          - type: 'null'
          description: Filter criteria for `Variable.value`
        tags:
          anyOf:
          - $ref: '#/components/schemas/VariableFilterTags'
          - type: 'null'
          description: Filter criteria for `Variable.tags`
      additionalProperties: false
      type: object
      title: VariableFilter
      description: Filter variables. Only variables matching all criteria will be returned
    VariableFilterId:
      properties:
        any_:
          anyOf:
          - items:
              type: string
              format: uuid
            type: array
          - type: 'null'
          title: Any
          description: A list of variable ids to include
      additionalProperties: false
      type: object
      title: VariableFilterId
      description: Filter by `Variable.id`.
    prefect_cloud__orion__schemas__filters__Operator:
      type: string
      enum:
      - and_
      - or_
      title: Operator
      description: Operators for combining filter criteria.
    VariableSort:
      type: string
      enum:
      - CREATED_DESC
      - UPDATED_DESC
      - NAME_DESC
      - NAME_ASC
      title: VariableSort
      description: Defines variables sorting options.
    VariableFilterValue:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: A list of variables value to include
        like_:
          anyOf:
          - type: string
          - type: 'null'
          title: Like
          description: A string to match variable value against. This can include SQL wildcard characters like `%` and `_`.
          examples:
          - my-value-%
      additionalProperties: false
      type: object
      title: VariableFilterValue
      description: Filter by `Variable.value`.
    VariableUpdate:
      properties:
        name:
          anyOf:
          - type: string
            maxLength: 255
          - type: 'null'
          title: Name
          description: The name of the variable
          examples:
          - my_variable
        value:
          anyOf:
          - type: string
          - type: integer
          - type: number
          - type: boolean
          - additionalProperties: true
            type: object
          - items: {}
            type: array
          - type: 'null'
          title: Value
          description: The value of the variable
          examples:
          - my-value
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: A list of variable tags
          examples:
          - - tag-1
            - tag-2
      additionalProperties: false
      type: object
      title: VariableUpdate
      description: Data used by the Orion API to update a Variable.
    VariableFilterName:
      properties:
        any_:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Any
          description: A list of variables names to include
        like_:
          anyOf:
          - type: string
          - type: 'null'
          title: Like
          description: A string to match variable names against. This can include SQL wildcard characters like `%` and `_`.
          examples:
          - my_variable_%
      additionalProperties: false
      type: object
      title: VariableFilterName
      description: Filter by `Variable.name`.
    Body_count_variables_api_accounts__account_id__workspaces__workspace_id__variables_count_post:
      properties:
        variables:
          anyOf:
          - $ref: '#/components/schemas/VariableFilter'
          - type: 'null'
      type: object
      title: Body_count_variables_api_accounts__account_id__workspaces__workspace_id__variables_count_post