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

# Create a contact

> Creates a contact. A contact needs a name and at least a phone number or an email address.



## OpenAPI

````yaml /api-reference/openapi.json post /devapi/accounts/{accountId}/contacts
openapi: 3.1.0
info:
  title: Gallabox Developer API
  version: 0.0.1
  summary: >-
    Send WhatsApp messages, manage contacts and conversations, and automate your
    Gallabox inbox.
  description: >
    The Gallabox Developer API lets your systems send WhatsApp and Instagram
    messages, keep contacts in sync, work

    the shared inbox, manage templates and broadcasts, and receive events
    through webhooks.


    ## Overview

    The API follows REST. URLs name resources, methods say what to do with them
    (`GET` reads, `POST` creates or

    acts, `PATCH` and `PUT` update, `DELETE` removes), request bodies are JSON
    (`Content-Type: application/json`),

    and every response is JSON. All requests go to `https://server.gallabox.com`
    over HTTPS, under `/devapi`.


    ## Concepts

    - **Account ID** (`accountId`): your Gallabox account. Most URLs contain it,
    as in
      `/devapi/accounts/{accountId}/contacts`, and it must be the account the API key belongs to. `GET /devapi/me`
      returns it.
    - **Channel ID** (`channelId`): one connected WhatsApp number, Instagram
    account, web chat or email inbox. Sending
      a message needs one. `GET /devapi/accounts/{accountId}/channels` lists them.
    - **Contact**, **conversation** and **message** IDs are 24-character
    hexadecimal strings returned by the API and
      included in webhook events.

    ## Authentication

    Create an API key on the **Settings** page in Gallabox. Send the key and its
    secret as headers on every

    request:


    ```http

    GET /devapi/me HTTP/1.1

    Host: server.gallabox.com

    apiKey: <your API key>

    apiSecret: <your API secret>

    ```


    `GET /devapi/me` is a good first call: it returns your user and account. A
    missing or wrong key returns `401`.

    Each key belongs to one account and has a permission scope (`all`,
    `restricted` or `read-only`) that decides

    what it may do.


    ## Rate limits

    - **General limit:** each account can make 200 requests a minute (your plan
    may allow more). Responses carry
      `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` (when the window resets). Over the limit
      you get `429` with `X-RateLimit-Retry-After`, the seconds to wait.
    - **Message sending:** the send endpoints (marked `x-rate-limit:
    message-send`) use a separate limit per plan:
      8, 16 or 5,000 messages every 5 seconds. Over the limit you get `429` with `Retry-After`, the seconds to wait.

    ```http

    HTTP/1.1 429 Too Many Requests

    X-RateLimit-Limit: 200

    X-RateLimit-Remaining: 0

    X-RateLimit-Retry-After: 42


    {"status": "RequestLimitHit", "message": "Account rate limit exceeded. Too
    many requests per minute."}

    ```


    ## Plans and permissions

    Some endpoints need a plan feature (listed under `x-entitlements`) or a
    permission on the API key's role

    (listed under `x-permissions`). Either one missing returns `403`, and each
    endpoint's `403` response says

    which. If the account is disconnected, every call returns `402` until it is
    active again.


    ## Errors

    Errors return a JSON body with `status` and `message`. Validation errors
    (`422`) add `error`, a readable

    summary, and `errors`, the problem with each field.


    | Code | Meaning |

    | --- | --- |

    | `401` | The API key or secret is missing or wrong. |

    | `402` | The account is disconnected. |

    | `403` | The plan doesn't include the feature, or the key's role doesn't
    allow the action. |

    | `404` | The resource doesn't exist in this account. |

    | `421` | A send was refused because of the contact's settings, such as no
    opt-in. |

    | `422` | The request failed validation. |

    | `429` | Rate limit reached. |
  contact:
    name: Gallabox Support
    url: https://gallabox.com
  license:
    name: Proprietary
servers:
  - url: https://server.gallabox.com
    description: Production
security:
  - apiKey: []
    apiSecret: []
tags:
  - name: Account
    description: The API key's account and wallet balance.
  - name: Messages
    description: Send WhatsApp messages, track delivery and read message history.
  - name: Direct Send
    description: >-
      Send a Utility message without creating a template first; Meta creates the
      template automatically.
  - name: Instagram
    description: Send Instagram direct messages.
  - name: Contacts
    description: Create, update, find and delete contacts, and manage their tags.
  - name: Segments
    description: Saved contact filters, used as broadcast audiences.
  - name: Tags
    description: The account's tags.
  - name: Custom Fields
    description: Custom contact fields.
  - name: Conversations
    description: Assign, tag, resolve and annotate conversations in the shared inbox.
  - name: WhatsApp Templates
    description: Create, list and edit WhatsApp message templates.
  - name: Broadcasts
    description: Send a template to a segment and read per-recipient results.
  - name: Webhooks
    description: >-
      Subscribe a URL to account events. Event payloads are listed under
      Webhooks in the reference.
  - name: WhatsApp Groups
    description: Create and manage WhatsApp groups, their participants and messages.
  - name: Users and Teams
    description: Invite and remove users, set availability, and map users to teams.
  - name: Channels
    description: The account's WhatsApp, Instagram and other channels.
  - name: Click-to-WhatsApp Ads
    description: Report conversions from Click-to-WhatsApp ads to Meta.
  - name: Analytics
    description: Template analytics and exports.
  - name: Media
    description: Upload media to use in messages and templates.
paths:
  /devapi/accounts/{accountId}/contacts:
    post:
      tags:
        - Contacts
      summary: Create a contact
      description: >-
        Creates a contact. A contact needs a name and at least a phone number or
        an email address.
      operationId: createContact
      parameters:
        - $ref: '#/components/parameters/accountId'
        - $ref: '#/components/parameters/excludePII'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                visitorId:
                  allOf:
                    - $ref: '#/components/schemas/ObjectId'
                  description: A web chat visitor to link to this contact.
                companyId:
                  allOf:
                    - $ref: '#/components/schemas/ObjectId'
                  description: The company the contact belongs to.
                phone:
                  type: array
                  items:
                    type: string
                    description: Phone number with country code, digits only.
                  description: Phone numbers with country code, digits only.
                email:
                  type: array
                  items:
                    type: string
                    format: email
                  description: Email addresses.
                name:
                  minLength: 1
                  type: string
                  description: The contact's name.
                messageOptIn:
                  type: boolean
                  description: Whether the contact agreed to receive marketing messages.
                contactOwnerId:
                  allOf:
                    - $ref: '#/components/schemas/ObjectId'
                  description: The user who owns the contact.
                tags:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        minLength: 1
                        type: string
                        maxLength: 50
                        description: Tag name.
                    required:
                      - name
                  description: Tags to add, by name. Tags that don't exist are created.
                address:
                  type: object
                  properties:
                    streetName:
                      minLength: 1
                      type: string
                      description: Street.
                    city:
                      minLength: 1
                      type: string
                      description: City.
                    region:
                      minLength: 1
                      type: string
                      description: State or region.
                    zipCode:
                      type: string
                      description: Postal code.
                    country:
                      minLength: 1
                      type: string
                      description: Country.
                  description: Postal address.
                social:
                  type: object
                  properties:
                    twitter:
                      type: string
                      format: uri
                      description: Twitter handle or URL.
                    facebook:
                      type: string
                      format: uri
                      description: Facebook profile URL.
                  description: Social profiles.
                instagram:
                  type: object
                  properties:
                    userName:
                      type: string
                      description: Instagram username.
                  description: Instagram details.
                fieldValues:
                  type: array
                  items:
                    type: object
                    properties:
                      fieldId:
                        allOf:
                          - $ref: '#/components/schemas/ObjectId'
                        description: The custom field.
                      type:
                        type: string
                        enum:
                          - TEXT
                          - TEXT_AREA
                          - MULTI_TEXT
                          - NUMBER
                          - SELECT
                          - MULTI_SELECT
                          - DATE
                          - USER
                          - FILE
                          - SWITCH
                          - URL
                          - EMAIL
                          - PHONE
                        description: The field's type.
                      valueString:
                        type: string
                        description: Value for `TEXT`, `TEXT_AREA` and `SELECT` fields.
                      valueArray:
                        type: array
                        description: Values for `MULTI_TEXT` and `MULTI_SELECT` fields.
                      valueUser:
                        minLength: 1
                        type: string
                        description: 'Value for user fields: a user ID.'
                      valueBoolean:
                        type: boolean
                        description: Value for yes/no fields.
                      valueNumber:
                        type: number
                        description: Value for `NUMBER` fields.
                      valueDate:
                        type: string
                        description: Value for date fields (ISO 8601).
                      valueFile:
                        type: object
                        description: Value for file fields.
                    required:
                      - fieldId
                  description: >-
                    Custom field values. Set the `value…` property that matches
                    `type`.
                marketingOptIn:
                  type: boolean
                  description: >-
                    Marketing opt-in. Stored as `messageOptIn`; an explicit
                    `messageOptIn` wins. Omit to keep the stored value.
              required:
                - name
      responses:
        '200':
          description: The new contact.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contact'
              example:
                id: 6650a1b2c3d4e5f6a7b8c9e1
                accountId: 6650a1b2c3d4e5f6a7b8c9d9
                name: Priya Sharma
                phone:
                  - '919876543210'
                email:
                  - priya@example.com
                tags:
                  - id: 6650a1b2c3d4e5f6a7b8c9f0
                    name: vip
                messageOptIn: true
                createdAt: '2026-11-20T09:12:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '403':
          description: >-
            Access denied.


            - **Plan:** the account's plan doesn't include the Contacts API.
            Upgrade the plan to use this endpoint.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                planFeature:
                  summary: Plan doesn't include the feature
                  value:
                    status: FORBIDDEN
                    message: Action not allowed - Please upgrade your plan
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    accountId:
      name: accountId
      in: path
      required: true
      description: Your Gallabox account ID. Must be the API key's own account.
      schema:
        $ref: '#/components/schemas/ObjectId'
    excludePII:
      name: excludePII
      in: query
      description: >-
        `true` leaves contacts' personal details, such as phone numbers and
        email addresses, out of the response.
      schema:
        type: boolean
  schemas:
    ObjectId:
      type: string
      pattern: ^[a-fA-F0-9]{24}$
      description: A 24-character hexadecimal ID.
      examples:
        - 6650a1b2c3d4e5f6a7b8c9d0
    Contact:
      type: object
      additionalProperties: true
      description: A contact. Main fields only; others may be present.
      properties:
        id:
          $ref: '#/components/schemas/ObjectId'
        accountId:
          $ref: '#/components/schemas/ObjectId'
        name:
          type: string
        phone:
          type: array
          items:
            type: string
          description: Phone numbers with country code, digits only.
        email:
          type: array
          items:
            type: string
            format: email
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        fieldValues:
          type: array
          items:
            type: object
            properties:
              fieldId:
                $ref: '#/components/schemas/ObjectId'
              type:
                type: string
              valueString:
                type: string
              valueNumber:
                type: number
              valueBoolean:
                type: boolean
              valueDate:
                type: string
                format: date-time
              valueArray:
                type: array
                items: {}
        messageOptIn:
          type: boolean
        contactOwnerId:
          $ref: '#/components/schemas/ObjectId'
        address:
          type: object
          properties:
            streetName:
              type: string
            city:
              type: string
            region:
              type: string
            zipCode:
              type: string
            country:
              type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
      example:
        id: 6650a1b2c3d4e5f6a7b8c9e1
        accountId: 6650a1b2c3d4e5f6a7b8c9d9
        name: Priya Sharma
        phone:
          - '919876543210'
        email:
          - priya@example.com
        tags:
          - id: 6650a1b2c3d4e5f6a7b8c9f0
            name: vip
        messageOptIn: true
        createdAt: '2026-11-20T09:12:00.000Z'
    Error:
      type: object
      required:
        - status
      properties:
        status:
          type: string
          description: >-
            Error category, for example `ERROR`, `UNAUTHORIZED`,
            `PAYMENT_REQUIRED`, `RequestLimitHit`.
        message:
          type: string
          description: Human-readable description.
        error:
          description: >-
            Extra detail. For validation errors, a comma-separated summary of
            every field error.
    Tag:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/ObjectId'
        name:
          type: string
    ValidationError:
      allOf:
        - $ref: '#/components/schemas/Error'
        - type: object
          properties:
            errors:
              type: array
              description: One object mapping each invalid field to its message.
              items:
                type: object
                additionalProperties:
                  type: string
      examples:
        - status: ERROR
          message: Invalid Input
          error: channelId is required
          errors:
            - channelId: channelId is required
  responses:
    Unauthorized:
      description: >-
        The API key or secret is missing or wrong, or the key does not belong to
        `{accountId}`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: Unauthorized
            message: Unauthorized
    PaymentRequired:
      description: >
        The account is disconnected, usually because its plan has lapsed. Every
        API call returns this until the account

        is active again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: PAYMENT_REQUIRED
            message: Account is Disconnected
    UnprocessableEntity:
      description: Validation failed. `errors` names each invalid field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: >
        The account went over its general limit: 200 requests a minute unless
        the plan allows more. Wait for

        `X-RateLimit-Retry-After` seconds and try again.
      headers:
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-RateLimit-Retry-After:
          $ref: '#/components/headers/X-RateLimit-Retry-After'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: RequestLimitHit
            message: Account rate limit exceeded. Too many requests per minute.
  headers:
    X-RateLimit-Limit:
      description: Requests allowed in the current window.
      schema:
        type: integer
    X-RateLimit-Remaining:
      description: Requests left in the current window.
      schema:
        type: integer
    X-RateLimit-Reset:
      description: When the current window resets, as a date string.
      schema:
        type: string
    X-RateLimit-Retry-After:
      description: Seconds to wait before retrying.
      schema:
        type: integer
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: apiKey
      description: API key from Settings → API keys.
    apiSecret:
      type: apiKey
      in: header
      name: apiSecret
      description: Secret shown once when the API key is created.

````

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