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

# Add Contacts

> Create a new contact in the workspace.

### JSON (Basic Contact)

```json theme={null}
{
  "number": "+14155550123",
  "name": "John Doe",
  "email": "john@example.com",
  "gender": "male"
}
```

### Multipart Form Data (Extended Contact)

If you want to upload an **avatar image**, assign **groups**, or set **status**, you must send the request as `multipart/form-data`. Example:

```
POST /contacts
Content-Type: multipart/form-data

number=+14155550123
name=John Doe
email=john@example.com
gender=male
status=1
avatar=@/path/to/image.png
contact_groups[]=12
contact_groups[]=15
```

***

### 📝 Field Requirements

| Field            | Type                    | Required | Notes                                                                |
| ---------------- | ----------------------- | -------- | -------------------------------------------------------------------- |
| `number`         | string                  | Yes      | WhatsApp phone number (must be unique in workspace).                 |
| `name`           | string (max 50)         | No       | Contact’s display name. Defaults to `Unknown` if not provided.       |
| `email`          | string (email)          | No       | Contact’s email address.                                             |
| `gender`         | enum(male,female,other) | No       | Gender of contact.                                                   |
| `status`         | boolean                 | No       | Defaults to `true`. Only available in form-data requests.            |
| `avatar`         | file (image, ≤2MB)      | No       | Upload contact avatar (form-data only).                              |
| `contact_groups` | array of integers       | No       | Group IDs to assign contact into (form-data only, workspace scoped). |

***


## OpenAPI

````yaml POST /workspaces/{workspace}/contacts
openapi: 3.1.0
info:
  title: Lancepilot API
  description: API for Lancepilot
  version: 1.0.0
  license:
    name: MIT
servers:
  - url: https://lancepilot.com/api/v3
security:
  - bearerAuth: []
paths:
  /workspaces/{workspace}/contacts:
    post:
      summary: Create a contact
      description: Create a new contact in the workspace.
      operationId: createContact
      parameters:
        - name: workspace
          in: path
          description: ID of the workspace.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                number:
                  type: string
                  example: '+14155550123'
                  description: The WhatsApp phone number of the contact
                name:
                  type: string
                  example: John Doe
                  maxLength: 50
                email:
                  type: string
                  format: email
                  example: john@example.com
                gender:
                  type: string
                  enum:
                    - male
                    - female
                    - other
                  example: male
              required:
                - number
            examples:
              basic:
                summary: Basic Contact
                value:
                  number: '+14155550123'
                  name: John Doe
                  email: john@example.com
                  gender: male
      responses:
        '201':
          $ref: '#/components/responses/201'
        '422':
          $ref: '#/components/responses/422'
components:
  responses:
    '201':
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 201
              message:
                type: string
                example: Resource created successfully.
              data:
                type: object
                description: Created resource data.
            required:
              - status
              - message
              - data
    '422':
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Validation error
              errors:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````