> ## Documentation Index
> Fetch the complete documentation index at: https://docs.databar.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a flow

> Create a workspace flow from a config. The config is validated exactly as the editor validates it, so an invalid graph is rejected here rather than failing later on every run.

<Info>
  The config is validated exactly as the editor validates it, so an invalid graph is rejected here rather than failing later on every run. A workspace at its plan's flow limit gets a `406`.
</Info>


## OpenAPI

````yaml POST /v1/flows/
openapi: 3.1.0
info:
  title: Databar.ai API
  description: >-

    # Authentication


    Databar uses API keys to allow access to the API. You can find your API key
    in your workspace home page, but to use the REST API you’ll first need to
    schedule a call with us.

    Our API expects the API key to be included in all API requests to the server
    in the Header of your request with the key `x-apikey`.

    To find your API key, head over to your Databar workspace and click
    Integrations.


    **Example:**


    `bash

    curl https://api.databar.ai/v1/user/me -H x-apikey: {YOUR_API_KEY}`
  contact:
    email: info@databar.ai
  version: 0.1.2
servers:
  - url: https://api.databar.ai
    description: Production
security: []
paths:
  /v1/flows/:
    post:
      tags:
        - Flows
      summary: Create a flow
      description: >-
        Create a workspace flow from a config. The config is validated exactly
        as the editor validates it, so an invalid graph is rejected here rather
        than failing later on every run.
      operationId: create_flow_v1_flows_post
      parameters:
        - name: x-apikey
          in: header
          required: true
          schema:
            type: string
            title: API Key
            description: API Key for authentication
          description: API Key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlowCreateIn'
      responses:
        '200':
          description: The created flow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlowDetail'
        '400':
          description: The config is not a valid flow; the message lists what is wrong
        '403':
          description: Forbidden
        '406':
          description: The workspace is at its plan's flow limit
components:
  schemas:
    FlowCreateIn:
      properties:
        name:
          type: string
          title: Name
          description: Display name of the flow.
        config:
          type: object
          title: Config
          description: >-
            Flow definition: `{inputs: [...], nodes: [...], output: {...}}`.
            Copy the shape of an existing flow from `GET /v1/flows/{flow_id}`.
        description:
          type: string
          title: Description
          default: ''
        ui:
          type: object
          title: Ui
          description: Editor-only metadata. The runtime ignores it.
          default: {}
      type: object
      required:
        - name
        - config
      title: FlowCreateIn
    FlowDetail:
      description: >-
        A flow plus the pieces needed to edit it. `config` is the graph, `ui` is
        editor-only metadata the runtime ignores, and `internal_version` is the
        concurrency token you send back on a write.
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/FlowInput'
          title: Inputs
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/FlowOutput'
          title: Outputs
        config:
          type: object
          title: Config
          description: 'The flow definition: `inputs`, `nodes`, `output`.'
        ui:
          type: object
          title: Ui
          description: Editor-only metadata. The runtime never reads it.
        internal_version:
          type: string
          title: Internal Version
          description: >-
            Concurrency token. Send it back on PUT (required) and on PATCH when
            changing `config`.
        created_at:
          type: string
          title: Created At
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - id
        - name
        - description
        - inputs
        - outputs
        - config
        - ui
        - internal_version
        - created_at
        - updated_at
      title: FlowDetail
    FlowInput:
      properties:
        id:
          type: string
          title: Id
          description: >-
            Unique identifier for this input (used as key in the `inputs` map
            when running the flow).
        description:
          type: string
          title: Description
        type:
          type: string
          title: Type
          description: Data type of the input, e.g. `text`.
        required:
          type: boolean
          title: Required
      type: object
      required:
        - id
        - description
        - type
        - required
      title: FlowInput
    FlowOutput:
      properties:
        id:
          type: string
          title: Id
        response_field_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Response Field Id
      type: object
      required:
        - id
      title: FlowOutput

````