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

# Create a workspace

> Creates a new partner-managed workspace and automatically provisions an Owner user. The workspace_id identifier is derived from the requested display_name (lowercase, alphanumeric and dashes, up to 30 characters). The workspace is created on the calling partner's plan and linked to that partner for ownership and billing-eligibility checks. An Owner user is created with a non-login, system-managed email of the form `<user_id>-<workspace-id>@partners.timelines.ai` and added to the default workspace group. Seats are allocated according to seats_purchased (1-999); the Owner consumes one seat and the remaining seats become available for additional agents. On success the response returns workspace metadata, seat counters and the newly created owner_user_id. Conflicts on identifier generation (duplicate workspace_id) are reported with a 409 WorkspaceCreationFailed error.



## OpenAPI

````yaml post /workspaces
openapi: 3.0.3
info:
  title: Partner API
  version: 1.0.1
  description: >-
    Partner-facing HTTP API used by approved integrators to provision and manage
    TimelinesAI workspaces, users and WhatsApp connections on behalf of their
    customers. All endpoints are versioned under /partner/api/v1 and secured
    with JWT bearer authentication. Obtaining a workspace Public API token,
    together with the capabilities of the Public API such as webhook
    subscriptions, enables partners to build complex integrations for their
    customers.
servers:
  - url: /partner/api/v1
    description: Partner API root URL
security:
  - bearerAuth: []
tags:
  - name: workspaces
  - name: users
  - name: whatsappAccounts
  - name: qr
  - name: publicAPI
paths:
  /workspaces:
    post:
      tags:
        - workspaces
      summary: Create a workspace
      description: >-
        Creates a new partner-managed workspace and automatically provisions an
        Owner user. The workspace_id identifier is derived from the requested
        display_name (lowercase, alphanumeric and dashes, up to 30 characters).
        The workspace is created on the calling partner's plan and linked to
        that partner for ownership and billing-eligibility checks. An Owner user
        is created with a non-login, system-managed email of the form
        `<user_id>-<workspace-id>@partners.timelines.ai` and added to the
        default workspace group. Seats are allocated according to
        seats_purchased (1-999); the Owner consumes one seat and the remaining
        seats become available for additional agents. On success the response
        returns workspace metadata, seat counters and the newly created
        owner_user_id. Conflicts on identifier generation (duplicate
        workspace_id) are reported with a 409 WorkspaceCreationFailed error.
      operationId: workspaceCreate
      parameters:
        - $ref: '#/components/parameters/X-TL-Partner-Id'
      requestBody:
        required: true
        description: Workspace creation request payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PartnerAPIWorkspaceCreateRequest'
      responses:
        '201':
          description: Workspace created
          headers:
            X-TL-API-Version:
              schema:
                type: string
              description: Partner API version. Current version is v1
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerAPIWorkspaceResponse'
        '409':
          $ref: '#/components/responses/WorkspaceCreationFailed'
components:
  parameters:
    X-TL-Partner-Id:
      name: X-TL-Partner-Id
      in: header
      description: The unique identifier for the partner.
      required: true
      schema:
        type: string
  schemas:
    PartnerAPIWorkspaceCreateRequest:
      type: object
      properties:
        display_name:
          type: string
          description: Workspace display name
          example: my-first-workspace (must contain only letters, digits and dash)
          minLength: 1
          maxLength: 100
        seats_purchased:
          type: integer
          description: Number of workspace seats
          example: 3
          minimum: 1
          maximum: 999
          default: 1
      required:
        - display_name
        - seats_purchased
      description: >-
        Request payload for creating a new partner-managed workspace. Partners
        supply a human-friendly display_name and the initial number of purchased
        seats. The server derives the internal workspace_id identifier from
        display_name and provisions the workspace on the partner’s plan with the
        requested seats.
    PartnerAPIWorkspaceResponse:
      type: object
      properties:
        workspace_id:
          type: string
          description: Unique identifier for the workspace
          example: ws_1234567890abcdef
        display_name:
          type: string
          description: Workspace display name
          example: my-first-workspace
        plan_id:
          type: integer
          description: Workspace plan type
          example: 1
        seats_total:
          type: integer
          description: Total number of seats in the workspace
          example: 3
        seats_available:
          type: integer
          description: Number of available seats in the workspace
          example: 2
        updated_at:
          type: string
          format: date-time
          description: Timestamp of the last update
          example: '2024-01-01T12:00:00Z'
        owner_user_id:
          type: integer
          description: User ID of the workspace owner
          example: 42
        group_id:
          type: integer
          description: Group ID associated with the workspace
          example: 7
        created_at:
          type: string
          format: date-time
          description: Timestamp of workspace creation
          example: '2024-01-01T10:00:00Z'
        suspended_members:
          type: array
          description: array of suspended user IDs
          items:
            $ref: '#/components/schemas/SuspendedMember'
      required:
        - workspace_id
        - display_name
        - plan_id
        - seats_total
        - seats_available
      description: >-
        Representation of a partner-managed workspace returned after creation or
        update. It includes the stable workspace_id, display_name, linked
        plan_id, seat allocation and utilization, audit timestamps, the default
        group identifier, the automatically generated Owner user, and any
        suspended members that resulted from a seat downgrade.
    SuspendedMember:
      type: object
      description: Suspended users
      properties:
        user_id:
          type: integer
          description: ID of the suspended user
          example: 123
        whatsapp_account_id:
          type: integer
          description: ID of the WhatsApp account associated with the suspended user
          example: 1092930
        phone_numbers:
          type: array
          items:
            type: string
          description: List of phone numbers associated with the suspended user
          example:
            - '+1234567890'
      required:
        - user_id
    PartnerAPIError:
      type: object
      properties:
        error:
          type: string
          description: Machine-readable error code
        status:
          type: integer
          description: HTTP status code
        description:
          type: string
          description: Human-readable error description
      required:
        - error
        - status
      description: >-
        Standard error envelope used by Partner API endpoints. The error field
        contains a machine-readable error code such as partner_not_found,
        partner_not_active, invalid_signature, timestamp_out_of_range,
        workspace_not_found, workspace_not_owned_by_partner or
        workspace_billing_managed. The status field repeats the HTTP status
        code, and description may contain a human-readable explanation suitable
        for logs and troubleshooting.
  responses:
    WorkspaceCreationFailed:
      description: Workspace with this name already exists
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/PartnerAPIError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT bearer authentication. The token payload must include partner_id,
        nbf (not-before) and exp (expiry) claims. All Partner API requests must
        be authenticated with Authorization: Bearer <token>.

````