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

# Actualizar tablero

> Actualiza el nombre, la descripción o el orden predeterminado de un tablero.

Actualiza parcialmente la configuración de un tablero.

## Endpoint

```text theme={null}
PATCH /databases/{databaseId}
```

## Body

Envía únicamente los campos que quieras modificar.

| Campo                   | Tipo     | Descripción                           |                                              |
| ----------------------- | -------- | ------------------------------------- | -------------------------------------------- |
| `name`                  | `string` | Nombre visible; no puede estar vacío. |                                              |
| `description`           | `string` | Descripción del tablero.              |                                              |
| `defaultSort`           | \`object | null\`                                | Orden predeterminado o `null` para quitarlo. |
| `defaultSort.fieldKey`  | `string` | `key` de un campo existente.          |                                              |
| `defaultSort.direction` | \`asc    | desc\`                                | Dirección del orden.                         |

<Warning>
  No envíes `fields` en esta operación. Usa los endpoints de Campos para crear, actualizar, reordenar o eliminar campos.
</Warning>

## Ejemplo de solicitud

```bash theme={null}
curl -X PATCH "https://api.insuranceboosters.com/api/v1/databases/{databaseId}" \
  -H "Content-Type: application/json" \
  -H "x-ib-api-key: TU_API_KEY" \
  -d '{
    "name": "Pólizas vigentes",
    "defaultSort": {
      "fieldKey": "fechaEmision",
      "direction": "desc"
    }
  }'
```

## Respuesta exitosa (`200`)

Devuelve el tablero completo con la configuración actualizada.

## Errores frecuentes

| HTTP  | Qué significa                                                                            | Qué hacer                                 |
| ----- | ---------------------------------------------------------------------------------------- | ----------------------------------------- |
| `400` | Body inválido, nombre vacío, campo de orden inexistente o intento de modificar `fields`. | Corrige el body y vuelve a enviar.        |
| `401` | API key inválida o faltante.                                                             | Verifica `x-ib-api-key`.                  |
| `404` | El tablero no existe.                                                                    | Confirma `databaseId`.                    |
| `500` | No fue posible actualizar el tablero.                                                    | Reintenta; si continúa, contacta soporte. |


## OpenAPI

````yaml openapi/tableros-v1.yaml PATCH /databases/{databaseId}
openapi: 3.1.0
info:
  title: Insurance Boosters API — Tableros
  version: 1.0.0
  description: API pública para administrar tableros, campos, registros y archivos.
  license:
    name: Propietaria
    url: https://insuranceboosters.com
servers:
  - url: https://api.insuranceboosters.com/api/v1
    description: Producción
security:
  - IbApiKey: []
tags:
  - name: Tableros
    description: Administración de tableros.
  - name: Campos
    description: Configuración del esquema de un tablero.
  - name: Registros
    description: Lectura y escritura de registros.
  - name: Archivos
    description: Archivos adjuntos a registros.
paths:
  /databases/{databaseId}:
    parameters:
      - $ref: '#/components/parameters/DatabaseId'
    patch:
      tags:
        - Tableros
      summary: Actualizar tablero
      operationId: updateDatabase
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDatabaseRequest'
            example:
              name: Pólizas 2026
              description: Control de pólizas vigentes
      responses:
        '200':
          description: Tablero actualizado.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Database'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    DatabaseId:
      name: databaseId
      in: path
      required: true
      description: ID del tablero.
      schema:
        type: string
  schemas:
    UpdateDatabaseRequest:
      type: object
      minProperties: 1
      additionalProperties: false
      properties:
        name:
          type: string
          minLength: 1
        description:
          type: string
        defaultSort:
          oneOf:
            - $ref: '#/components/schemas/DatabaseSort'
            - type: 'null'
          description: Envía `null` para quitar el orden predeterminado.
    Database:
      type: object
      required:
        - id
        - name
        - fields
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
        name:
          type: string
        description:
          type: string
        fields:
          type: array
          items:
            $ref: '#/components/schemas/Field'
        defaultSort:
          $ref: '#/components/schemas/DatabaseSort'
        createdAt:
          type: integer
        updatedAt:
          type: integer
    DatabaseSort:
      type: object
      additionalProperties: false
      required:
        - fieldKey
        - direction
      properties:
        fieldKey:
          type: string
          minLength: 1
          description: '`key` de un campo existente.'
        direction:
          type: string
          enum:
            - asc
            - desc
    Field:
      allOf:
        - $ref: '#/components/schemas/FieldInputProperties'
        - type: object
          required:
            - id
            - key
            - name
            - type
          properties:
            id:
              type: string
            inverseFieldId:
              type: string
            relationPairId:
              type: string
    Error:
      type: object
      properties:
        message:
          type: string
        error:
          type: string
      additionalProperties: false
    FieldInputProperties:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: Nombre visible del campo.
        key:
          type: string
          pattern: ^[a-z][a-zA-Z0-9]*(?:_[a-z0-9]+)*$
          description: Clave estable; se genera desde `name` si la omites.
        type:
          type: string
          enum:
            - string
            - number
            - boolean
            - date
            - enum
            - enum_multi
            - relation_single
            - relation_multi
            - contact_single
            - contact_multi
            - lookup
            - files
          description: Tipo inmutable después de crear el campo.
        required:
          type: boolean
          default: false
          description: >-
            Marca el campo como obligatorio en el esquema y en la captura del
            tablero.
        description:
          type: string
        defaultValue:
          description: Valor predeterminado para tipos compatibles.
        dateConfig:
          allOf:
            - $ref: '#/components/schemas/DateConfig'
          description: Configuración de presentación cuando `type` es `date`.
        options:
          type: array
          minItems: 1
          description: Requerido para `enum` y `enum_multi`.
          items:
            $ref: '#/components/schemas/EnumOptionInput'
        toDatabaseId:
          type: string
          description: Requerido para campos de relación.
        displayFieldId:
          type: string
          description: Campo mostrado en relaciones o contactos.
        bidirectional:
          type: boolean
          default: false
        inverseField:
          $ref: '#/components/schemas/InverseFieldInput'
        relationFieldId:
          type: string
          description: Requerido para `lookup`.
        targetFieldId:
          type: string
          description: Requerido para `lookup`.
        multipleValuesBehavior:
          type: string
          enum:
            - allValues
            - uniqueValues
            - firstValue
            - lastValue
          description: Requerido para `lookup`.
        maxFiles:
          type: integer
          minimum: 1
          description: Máximo de archivos cuando `type` es `files`.
        accept:
          type: array
          description: Tipos MIME aceptados cuando `type` es `files`.
          items:
            type: string
        numberFormat:
          $ref: '#/components/schemas/NumberFormat'
    DateConfig:
      type: object
      additionalProperties: false
      required:
        - includeTime
      properties:
        includeTime:
          type: boolean
          default: false
          description: >-
            Controla si el tablero captura y muestra hora. No cambia la
            validación del valor.
    EnumOptionInput:
      type: object
      additionalProperties: false
      required:
        - label
      properties:
        id:
          type: string
          description: ID estable; se genera automáticamente si lo omites.
        label:
          type: string
          minLength: 1
        color:
          type: string
        order:
          type: integer
          minimum: 0
    InverseFieldInput:
      type: object
      additionalProperties: false
      description: >-
        Vincula un campo existente con `id` o crea uno nuevo con `name` y
        `type`.
      properties:
        id:
          type: string
          description: ID de un campo de relación existente en el tablero destino.
        name:
          type: string
          minLength: 1
          description: Nombre de un campo inverso nuevo.
        key:
          type: string
          pattern: ^[a-z][a-zA-Z0-9]*(?:_[a-z0-9]+)*$
        type:
          type: string
          enum:
            - relation_single
            - relation_multi
        displayFieldId:
          type: string
    NumberFormat:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - none
            - currency
            - percent
          description: Formato visual del número.
        currencyCode:
          type: string
          enum:
            - USD
            - EUR
            - MXN
            - BRL
            - ARS
            - COP
            - CLP
            - PEN
            - UYU
            - GTQ
          description: Requerido cuando `type` es `currency`.
        decimalPlaces:
          type: integer
          minimum: 0
          maximum: 6
          default: 2
        thousandsSeparator:
          type: boolean
          default: true
  responses:
    BadRequest:
      description: Solicitud inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: API key inválida o faltante.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Recurso no encontrado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Error del servicio.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    IbApiKey:
      type: apiKey
      in: header
      name: x-ib-api-key
      description: API key de Insurance Boosters.

````