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

# Post Workflows

> Creates a new workflow associated with the specified team (and owned by the user sending the request).



## OpenAPI

````yaml post /workflows
openapi: 3.1.0
info:
  title: Playbook API Documentation
  description: >-
    This is the documentation for the Playbook API. You can use this API to use
    our service programmatically, this is done by using your API key. <br/> You
    can view your API key using the 'User' tab on https://beta.playbook3d.com/.
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /workflows:
    post:
      tags:
        - workflows
      summary: Create a New Workflow
      description: >-
        Creates a new workflow associated with the specified team (and owned by
        the user sending the request).
      operationId: create_workflow
      parameters:
        - name: x-api-key
          in: header
          description: >-
            Your API key. This is required by most endpoints to access the API
            programmatically. You can view your x-api-key using the 'Profile'
            tab on the website.
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer token for authentication (JWT).
          required: true
          schema:
            type: string
      requestBody:
        required: true
        description: JSON data defining the workflow to be created.
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Name of the workflow.
                team_id:
                  type: string
                  description: UUID of the team with which this workflow is associated.
                is_external:
                  type: boolean
                  description: Indicates if the workflow is an external one.
                canvas_type:
                  type: integer
                  description: Canvas type (0 for basic, 1 for advanced, etc.).
                public:
                  type: boolean
                  description: Whether the workflow is public or private.
              example:
                name: My Scripted Workflow
                team_id: 41480ee5-14ff-4f9e-89bf-9750a8e30e77
                is_external: false
                canvas_type: 0
                public: false
      responses:
        '200':
          description: >-
            Successfully created workflow (some code returns 200). Returns the
            new workflow in JSON.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The newly created workflow’s UUID.
                  name:
                    type: string
                    description: Name of the newly created workflow.
                example:
                  id: d0763222-8f38-46aa-a96e-2532038e49b8
                  name: My Scripted Workflow
        '201':
          description: >-
            Successfully created workflow (if the code returns 201 instead of
            200). Same schema as 200.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The newly created workflow’s UUID.
                  name:
                    type: string
                    description: Name of the newly created workflow.
                example:
                  id: d0763222-8f38-46aa-a96e-2532038e49b8
                  name: My Scripted Workflow
        '400':
          description: Bad Request. Possibly invalid JSON or missing fields.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Bad Request. Possibly invalid JSON or missing fields.
                example:
                  description: Bad Request. Possibly invalid JSON or missing fields.
        '401':
          description: Unauthorized. Check your JWT or API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: >-
                      Unauthorized. The Bearer token or API key is invalid or
                      missing.
                example:
                  description: >-
                    Unauthorized. The Bearer token or API key is invalid or
                    missing.
        '403':
          description: >-
            Forbidden. You don't have permission to create a workflow under the
            specified team.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Forbidden. The user does not have the required permission.
                example:
                  description: Forbidden. The user does not have the required permission.
        '404':
          description: >-
            Not Found. Possibly the endpoint is spelled incorrectly or the
            specified team doesn't exist.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: >-
                      Not Found. Possibly the endpoint is spelled incorrectly or
                      the specified team doesn't exist.
                example:
                  description: >-
                    Not Found. Possibly the endpoint is spelled incorrectly or
                    the specified team doesn't exist.
        '500':
          description: Internal Server Error. Something went wrong on the server.
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                    description: Internal Server Error. Something went wrong on the server.
                example:
                  description: Internal Server Error. Something went wrong on the server.
      x-codeSamples:
        - lang: cURL
          source: |-
            curl -X POST \
              -H 'Authorization: Bearer $API_KEY' \
              -H 'Content-Type: application/json' \
              -H 'Accept: application/json' \
              -d '{"name": "My Scripted Workflow", "team_id": "YOUR_TEAM_ID", "is_external": false, "canvas_type": 0, "public": false}' \
              '$BASE_URL/workflows'
        - lang: Python
          source: >-
            import requests


            headers = {
              'x-api-key': '<YOUR_API_KEY>',
              'Authorization': 'Bearer <YOUR_JWT_TOKEN>',
              'Content-Type': 'application/json',
              'Accept': 'application/json'
            }

            data = {
              'name': 'My Scripted Workflow',
              'team_id': '41480ee5-14ff-4f9e-89bf-91b0a8e50e77',
              'is_external': False,
              'canvas_type': 0,
              'public': False
            }


            resp = requests.post('https://accounts.playbook3d.com/workflows',
            json=data, headers=headers)

            print(resp.status_code, resp.json())
        - lang: JavaScript
          source: |-
            fetch('https://accounts.playbook3d.com/workflows', {
              method: 'POST',
              headers: {
                'x-api-key': '<YOUR_API_KEY>',
                'Authorization': 'Bearer <YOUR_JWT_TOKEN>',
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              },
              body: JSON.stringify({
                name: 'My Scripted Workflow',
                team_id: '41480ee5-14ff-4f9e-89bf-91b0a8e50e77',
                is_external: false,
                canvas_type: 0,
                public: false
              })
            })
              .then(res => res.json())
              .then(data => console.log(data))
              .catch(err => console.error(err));
        - lang: C#
          source: >-
            // Using HttpClient

            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Add("x-api-key", "<YOUR_API_KEY>");

            client.DefaultRequestHeaders.Authorization = new
            AuthenticationHeaderValue("Bearer", "<YOUR_JWT_TOKEN>");


            var newWorkflow = new {
                name = "My Scripted Workflow",
                team_id = "41480ee5-14ff-4f9e-89bf-91b0a8e50e77",
                is_external = false,
                canvas_type = 0,
                _public = false
            };


            var content = new StringContent(
                JsonConvert.SerializeObject(newWorkflow), Encoding.UTF8, "application/json");
            var response = await
            client.PostAsync("https://accounts.playbook3d.com/workflows",
            content);

            string respContent = await response.Content.ReadAsStringAsync();

            Console.WriteLine(response.StatusCode);

            Console.WriteLine(respContent);

````