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

# Crear contacto

> Crea un contacto con los campos configurados para tu cuenta.

Crea un contacto y obtén el `id` que usarás en las demás operaciones.

## Endpoint

```text theme={null}
POST /contacts
```

## Body

Envía un objeto JSON con los campos configurados para tu cuenta. Todos los campos son opcionales, pero cada valor enviado debe respetar el tipo y las reglas del campo.

| Campo común    | Tipo       | Descripción                                |
| -------------- | ---------- | ------------------------------------------ |
| `firstName`    | `string`   | Nombre; máximo `100` caracteres.           |
| `lastName1`    | `string`   | Primer apellido; máximo `100` caracteres.  |
| `lastName2`    | `string`   | Segundo apellido; máximo `100` caracteres. |
| `email`        | `string`   | Correo electrónico válido.                 |
| `phoneNumbers` | `string[]` | Lista de teléfonos.                        |

## Ejemplo de solicitud

```bash theme={null}
curl -X POST "https://api.insuranceboosters.com/api/v1/contacts" \
  -H "Content-Type: application/json" \
  -H "x-ib-api-key: TU_API_KEY" \
  -d '{
    "firstName": "María",
    "lastName1": "García",
    "email": "maria.garcia@example.com",
    "phoneNumbers": ["+525500000000"]
  }'
```

## Respuesta exitosa (`201`)

```json theme={null}
{
  "success": true,
  "id": "<contact-id>",
  "message": "Contact created successfully"
}
```

Guarda `id`; lo necesitarás para consultar, actualizar, eliminar o vincular el contacto.

## Errores frecuentes

| HTTP  | Qué significa                                       | Qué hacer                                   |
| ----- | --------------------------------------------------- | ------------------------------------------- |
| `400` | Un campo no existe o su valor no cumple el esquema. | Revisa el nombre, tipo y formato del campo. |
| `401` | API key inválida o faltante.                        | Verifica `x-ib-api-key`.                    |
| `500` | No fue posible crear el contacto.                   | Reintenta; si continúa, contacta soporte.   |


## OpenAPI

````yaml openapi/contactos-v1.yaml POST /contacts
openapi: 3.1.0
info:
  title: Insurance Boosters API — Contactos
  version: 1.0.0
  description: >-
    API pública para consultar el esquema y crear, listar, buscar, actualizar o
    eliminar contactos.
  license:
    name: Propietaria
    url: https://insuranceboosters.com
servers:
  - url: https://api.insuranceboosters.com/api/v1
    description: Producción
security:
  - IbApiKey: []
tags:
  - name: Contactos
    description: Administración de contactos.
paths:
  /contacts:
    post:
      tags:
        - Contactos
      summary: Crear contacto
      operationId: createContact
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactInput'
            example:
              firstName: María
              lastName1: García
              email: maria.garcia@example.com
              phoneNumbers:
                - '+525500000000'
      responses:
        '201':
          description: Contacto creado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MutationResponse'
              example:
                success: true
                id: <contact-id>
                message: Contact created successfully
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    ContactInput:
      type: object
      description: Campos editables configurados para tu cuenta.
      additionalProperties: true
      properties:
        firstName:
          type: string
          minLength: 1
          maxLength: 100
          description: Nombre.
        lastName1:
          type: string
          minLength: 1
          maxLength: 100
          description: Primer apellido.
        lastName2:
          type: string
          maxLength: 100
          description: Segundo apellido.
        email:
          type: string
          format: email
          description: Correo electrónico.
        phoneNumbers:
          type: array
          description: Teléfonos del contacto.
          items:
            type: string
    MutationResponse:
      type: object
      required:
        - success
        - id
        - message
      properties:
        success:
          type: boolean
          const: true
        id:
          type: string
        message:
          type: string
    Error:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
  responses:
    BadRequest:
      description: La solicitud no cumple el esquema de contactos.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: API key inválida o faltante.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Error inesperado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    IbApiKey:
      type: apiKey
      in: header
      name: x-ib-api-key

````