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

# Create a flow

> Creates a new WhatsApp Flow. New Flows are by default created in DRAFT state. You can create a new published Flow in single request by specifying flowJson and publish parameters.



## OpenAPI

````yaml /openapi/endpoints/ycloud-api-v2.yaml post /whatsapp/flows
openapi: 3.0.0
info:
  description: >-
    The [YCloud](https://ycloud.com) API is organized around
    [REST](https://en.wikipedia.org/wiki/Representational_state_transfer). Our
    API is designed to have predictable, resource-oriented URLs, return
    [JSON](https://www.json.org) responses, and use standard HTTP response codes
    and verbs.
  version: v2
  title: YCloud API
  termsOfService: https://ycloud.com/terms-service
  contact:
    email: service@ycloud.com
servers:
  - url: https://api.ycloud.com/v2
    description: Base URL
security:
  - api_key: []
tags:
  - name: Balance
  - name: Contacts
  - name: Custom Events
  - name: Emails
  - name: SMS
  - name: Unsubscribers
  - name: Verify
  - name: Voices
  - name: Webhook Endpoints
  - name: WhatsApp Business Accounts
  - name: WhatsApp Inbound Messages
  - name: WhatsApp Media
  - name: WhatsApp Messages
  - name: WhatsApp Blocked Users
  - name: WhatsApp Groups
  - name: WhatsApp Calling
  - name: WhatsApp Phone Numbers
  - name: WhatsApp Templates
  - name: WhatsApp Flows
  - name: Meta Business Agent
  - name: WhatsApp Group Messages
externalDocs:
  description: Homepage
  url: https://ycloud.com
paths:
  /whatsapp/flows:
    post:
      tags:
        - WhatsApp Flows
      summary: Create a flow
      description: >-
        Creates a new WhatsApp Flow. New Flows are by default created in DRAFT
        state. You can create a new published Flow in single request by
        specifying flowJson and publish parameters.
      operationId: whatsapp_flow-create
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - wabaId
                - name
                - categories
              properties:
                wabaId:
                  type: string
                  description: WhatsApp Business Account ID.
                  example: whatsapp-business-account-id
                name:
                  type: string
                  description: Flow name.
                  example: My first flow
                categories:
                  type: array
                  description: Flow categories.
                  items:
                    $ref: '#/components/schemas/WhatsappFlowCategory'
                flowJson:
                  type: string
                  description: JSON string of the Flow structure.
                  example: >-
                    {"version":"5.0","screens":[{"id":"WELCOME_SCREEN","layout":{"type":"SingleColumnLayout","children":[{"type":"TextHeading","text":"Hello
                    World"},{"type":"Footer","label":"Complete","on-click-action":{"name":"complete","payload":{}}}]},"title":"Welcome","terminal":true,"success":true,"data":{}}]}
                publish:
                  type: boolean
                  description: If true, the Flow will be created in PUBLISHED state.
                  default: false
                cloneFlowId:
                  type: string
                  description: >-
                    ID of source Flow to clone. You must have permission to
                    access the specified Flow.
                  example: flow-id-to-clone
                endpointUri:
                  type: string
                  description: The endpoint URI for the Flow.
                  example: https://example.com/flow-endpoint
        required: true
      responses:
        '200':
          description: Successfully created a flow.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: The ID of the created Flow.
                    example: flow-1
                  success:
                    type: boolean
                    description: Whether the operation was successful.
                    example: true
        '400':
          description: Bad request. The Flow may be invalid.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: Whether the operation was successful.
                    example: false
                  validationErrors:
                    type: array
                    description: List of validation errors.
                    items:
                      $ref: '#/components/schemas/WhatsappFlowValidationError'
components:
  schemas:
    WhatsappFlowCategory:
      type: string
      description: |-
        Category of the WhatsApp Flow.
        - `SIGN_UP`: For sign-up processes.
        - `SIGN_IN`: For sign-in processes.
        - `APPOINTMENT_BOOKING`: For booking appointments.
        - `LEAD_GENERATION`: For lead generation.
        - `CONTACT_US`: For contact forms.
        - `CUSTOMER_SUPPORT`: For customer support.
        - `SURVEY`: For surveys.
        - `OTHER`: For other purposes.
      enum:
        - SIGN_UP
        - SIGN_IN
        - APPOINTMENT_BOOKING
        - LEAD_GENERATION
        - CONTACT_US
        - CUSTOMER_SUPPORT
        - SURVEY
        - OTHER
    WhatsappFlowValidationError:
      type: object
      description: Represents a validation error in a WhatsApp Flow.
      properties:
        error:
          type: string
          description: Error code.
          example: INVALID_PROPERTY_VALUE
        errorType:
          type: string
          description: Error type.
          example: FLOW_JSON_ERROR
        message:
          type: string
          description: Error message.
          example: Invalid value found for property 'type'.
        lineStart:
          type: integer
          description: Start line of the error.
          example: 10
        lineEnd:
          type: integer
          description: End line of the error.
          example: 10
        columnStart:
          type: integer
          description: Start column of the error.
          example: 21
        columnEnd:
          type: integer
          description: End column of the error.
          example: 34
        pointers:
          type: array
          description: List of pointers to the error location.
          items:
            type: object
            properties:
              lineStart:
                type: integer
                description: Start line of the error.
                example: 10
              lineEnd:
                type: integer
                description: End line of the error.
                example: 10
              columnStart:
                type: integer
                description: Start column of the error.
                example: 21
              columnEnd:
                type: integer
                description: End column of the error.
                example: 34
              path:
                type: string
                description: Path to the error location.
                example: screens[0].layout.children[0].type
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.