> ## 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.

# Update Contact

> Update an existing contact in the workspace.

### JSON Example

```json theme={null}
{
  "name": "John Smith",
  "email": "johnsmith@example.com",
  "gender": "male",
  "status": true
}
```

### Multipart Form Data Example

```
PUT /contacts/123
Content-Type: multipart/form-data

name=John Smith
email=johnsmith@example.com
gender=male
status=1
avatar=@/path/to/avatar.png
contact_groups[]=10
contact_groups[]=12
```

***

### 📝 Field Requirements for Update

| Field            | Type                    | Required | Notes                                                    |
| ---------------- | ----------------------- | -------- | -------------------------------------------------------- |
| `name`           | string (max 50)         | Yes      | Contact’s display name                                   |
| `email`          | string (email)          | No       | Contact email                                            |
| `gender`         | enum(male,female,other) | No       | Gender of contact                                        |
| `status`         | boolean                 | No       | Contact active status                                    |
| `avatar`         | file (image ≤2MB)       | No       | Upload new avatar (form-data only)                       |
| `contact_groups` | array of integers       | No       | Assign contact groups (form-data only, workspace scoped) |


## OpenAPI

````yaml POST /workspaces/{workspace}/contacts/{contact}
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/{contact}:
    post:
      summary: Update a contact
      description: Update an existing contact in the workspace.
      operationId: updateContact
      parameters:
        - name: workspace
          in: path
          description: ID of the workspace.
          required: true
          schema:
            type: string
            format: uuid
        - name: contact
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The ID of the contact to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                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
                status:
                  type: boolean
                  example: true
              required:
                - name
            examples:
              updateContact:
                summary: Basic update
                value:
                  name: John Smith
                  email: johnsmith@example.com
                  gender: male
                  status: true
      responses:
        '200':
          $ref: '#/components/responses/Update200'
        '404':
          $ref: '#/components/responses/404'
        '422':
          $ref: '#/components/responses/422'
components:
  responses:
    '404':
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                example: Resource not found.
              status:
                type: integer
                example: 404
            required:
              - message
              - status
    '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
    Update200:
      description: ''
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: integer
                example: 200
              message:
                type: string
                example: Resource updated successfully.
              data:
                type: object
                description: Updated resource data.
            required:
              - status
              - message
              - data
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````