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

# Company Enrichment

> Enrich a company list with research columns at scale.

## Overview

This guide walks through adding research columns and running structured enrichment on a company list.
The inputs can come from Extruct discovery or from your own company list.

## Prerequisites

```bash theme={null}
export EXTRUCT_API_TOKEN="YOUR_API_TOKEN"
```

Generate tokens in [Dashboard API Tokens](https://app.extruct.ai/api-tokens). For full setup, see [Authentication](/api-reference/authentication).

## Endpoints used

* [Create table (`POST /v1/tables`)](/api-reference/tables/create-table)
* [Create columns (`POST /v1/tables/:table_id/columns`)](/api-reference/tables/create-table-columns)
* [Add rows (`POST /v1/tables/:table_id/rows`)](/api-reference/tables/create-table-rows)
* [Run table (`POST /v1/tables/:table_id/run`)](/api-reference/tables/run-table)
* [Get table data (`GET /v1/tables/:table_id/data`)](/api-reference/tables/get-table-data)

## Workflow

### 1) Create a base table

The create-table response includes `id`, which you will reuse as `TABLE_ID`.

```bash theme={null}
TABLE_RESPONSE=$(curl -sS -X POST "https://api.extruct.ai/v1/tables" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${EXTRUCT_API_TOKEN}" \
  -d '{
    "name": "Enrichment Pipeline",
    "kind": "company",
    "column_configs": [
      {
        "kind": "input",
        "name": "Company",
        "key": "input"
      }
    ]
  }')

TABLE_ID=$(echo "${TABLE_RESPONSE}" | jq -r '.id')
echo "${TABLE_ID}"
```

Requires `jq`. If unavailable, copy `id` manually from response.

### 2) Add enrichment columns

Use [Column Guide](/api-guides/ai-tables/column-guide) for minimum working shapes, agent-type guidance, output formats, and prompt rules. Use [Column Library](/api-guides/ai-tables/column-library) when you want fuller reusable templates and scoring patterns.

```bash theme={null}
curl -X POST "https://api.extruct.ai/v1/tables/${TABLE_ID}/columns" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${EXTRUCT_API_TOKEN}" \
  -d '{
    "column_configs": [
      {
        "kind": "agent",
        "name": "Short Description",
        "key": "short_description",
        "value": {
          "agent_type": "research_pro",
          "prompt": "Summarize what the company does in 2 sentences.",
          "output_format": "text"
        }
      },
      {
        "kind": "agent",
        "name": "Target Audience",
        "key": "target_audience",
        "value": {
          "agent_type": "research_pro",
          "prompt": "Describe the company's core buyer or user.",
          "output_format": "text"
        }
      }
    ]
  }'
```

### 3) Add company rows and run

```bash theme={null}
curl -X POST "https://api.extruct.ai/v1/tables/${TABLE_ID}/rows" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${EXTRUCT_API_TOKEN}" \
  -d '{
    "rows": [
      {"data": {"input": "https://stripe.com"}},
      {"data": {"input": "https://openai.com"}},
      {"data": {"input": "https://anthropic.com"}}
    ],
    "run": true
  }'
```

### 4) Check run status

```bash theme={null}
curl --get "https://api.extruct.ai/v1/tables/${TABLE_ID}" \
  -H "Authorization: Bearer ${EXTRUCT_API_TOKEN}"
```

Proceed when `run_status` is `idle` and `num_cells_in_progress` is `0`.

### 5) Read enriched output

```bash theme={null}
curl --get "https://api.extruct.ai/v1/tables/${TABLE_ID}/data" \
  -H "Authorization: Bearer ${EXTRUCT_API_TOKEN}" \
  --data-urlencode "offset=0" \
  --data-urlencode "limit=100"
```

## Troubleshooting

### `401 Unauthorized`

The token is missing or invalid.
Check that `EXTRUCT_API_TOKEN` is set and the header is exactly `Authorization: Bearer ${EXTRUCT_API_TOKEN}`.

### `422 Unprocessable Entity`

Common causes:

* Invalid column config shape for `agent` columns.
* Missing required `data` in row payloads.
* Invalid JSON body.

Validate your payload JSON before sending: `echo '<json-body>' | jq empty`.
