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

# Add enrichment to table

> Add an enrichment to a table by its UUID.

## Mapping format

The `mapping` object links enrichment parameters to table columns (or hardcoded values).

Each key is an **enrichment parameter slug** (from `GET /v1/enrichments/{id}` → `params[].name`).

Each value is one of:

| Type        | When to use                      | `value` field                               |
| ----------- | -------------------------------- | ------------------------------------------- |
| `"mapping"` | Read value from a column per row | Human-readable column name (e.g. `"email"`) |
| `"simple"`  | Same static value for every row  | The literal value (e.g. `"US"`)             |

```json theme={null}
{
  "enrichment": 123,
  "mapping": {
    "email": {
      "type": "mapping",
      "value": "email"
    },
    "country": {
      "type": "simple",
      "value": "US"
    }
  }
}
```

## After adding

The response body is `{}`. To get the **table-enrichment ID** required by `POST /v1/table/{table_uuid}/run-enrichment/{id}`, call:

```
GET /v1/table/{table_uuid}/enrichments
```

and use the `id` field of the newly added entry.


## OpenAPI

````yaml POST /v1/table/{table_uuid}/add-enrichment
openapi: 3.1.0
info:
  title: Databar.ai API
  description: >-

    # Authentication


    Databar uses API keys to allow access to the API. You can find your API key
    in your workspace home page, but to use the REST API you’ll first need to
    schedule a call with us.

    Our API expects the API key to be included in all API requests to the server
    in the Header of your request with the key `x-apikey`.

    To find your API key, head over to your Databar workspace and click
    Integrations.


    **Example:**


    `bash

    curl https://api.databar.ai/v1/user/me -H x-apikey: {YOUR_API_KEY}`
  contact:
    email: info@databar.ai
  version: 0.1.2
servers:
  - url: https://api.databar.ai
    description: Production
security: []
paths:
  /v1/table/{table_uuid}/add-enrichment:
    post:
      tags:
        - Table
      summary: Add enrichment to table
      description: Add an enrichment to a table by its UUID.
      operationId: Add_enrichment_to_table_v1_table__table_uuid__add_enrichment_post
      parameters:
        - name: table_uuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: The UUID of the table
            title: Table Uuid
          description: The UUID of the table
        - name: x-apikey
          in: header
          required: true
          schema:
            type: string
            title: API Key
            description: API Key for authentication
          description: API Key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddEnrichment'
            examples:
              with_column_uuid:
                summary: Mapping with column UUID
                description: >-
                  Pass the column identifier (UUID) from GET
                  /v1/table/{uuid}/columns.
                value:
                  enrichment: 1
                  mapping:
                    email:
                      value: 42902e11-fa09-4abd-a627-77c07fc40cde
                      type: mapping
                    country:
                      value: US
                      type: simple
              with_column_name:
                summary: Mapping with column name from rows
                description: >-
                  Use the column name as it appears in GET /v1/table/{uuid}/rows
                  response.
                value:
                  enrichment: 1
                  mapping:
                    email:
                      value: email_address
                      type: mapping
                    country:
                      value: US
                      type: simple
      responses:
        '200':
          description: Enrichment added successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddEnrichmentResponse'
              example:
                id: 42
                enrichment_name: Email Verification
        '403':
          description: Forbidden
          content:
            application/json:
              example:
                detail: Not allowed
        '404':
          description: Table not found
          content:
            application/json:
              example:
                detail: Table not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AddEnrichment:
      properties:
        enrichment:
          type: integer
          title: Enrichment
          description: The enrichment ID to add.
        mapping:
          additionalProperties:
            $ref: '#/components/schemas/MappingEntry'
          type: object
          title: Mapping
          description: Parameter mapping. Keys are enrichment parameter slugs.
        launch_strategy:
          type: string
          enum:
            - run_on_click
            - run_on_update
          title: Launch Strategy
          description: >-
            When to run: 'run_on_click' (manual only) or 'run_on_update'
            (auto-trigger when mapped input columns change).
          default: run_on_click
      type: object
      required:
        - enrichment
        - mapping
      title: AddEnrichment
    AddEnrichmentResponse:
      properties:
        id:
          type: integer
          title: Id
        enrichment_name:
          type: string
          title: Enrichment Name
      type: object
      required:
        - id
        - enrichment_name
      title: AddEnrichmentResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    MappingEntry:
      properties:
        value:
          type: string
          title: Value
          description: >-
            For type='mapping': the column identifier (UUID) or column name (the
            key used in GET /v1/table/{uuid}/rows response). Get identifiers
            from GET /v1/table/{uuid}/columns. For type='simple': a static value
            used for every row.
        type:
          type: string
          enum:
            - mapping
            - simple
          title: Type
          description: >-
            'mapping' reads the value from a table column for each row. 'simple'
            uses the same static value for every row.
      type: object
      required:
        - value
        - type
      title: MappingEntry
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````