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

# Bulk Company Enrichment API

## Overview

The Bulk Company Enrichment API provides a way to enrich multiple profiles using the [Company Enrichment API](https://docs.peopledatalabs.com/docs/company-enrichment-api) in one request.

<Image align="center" src="https://files.readme.io/ed608ae-Bulk_Company_Enrich.svg" />

> 📘 Bulk Enrichment vs Company Search
>
> The Bulk Enrichment API is **NOT** the same as the [Company Search API](https://docs.peopledatalabs.com/docs/company-search-api).
>
> The Bulk Enrichment API is the same as calling the [Company Enrichment API](https://docs.peopledatalabs.com/docs/company-enrichment-api) multiple times.
>
> Use the Bulk Enrichment API when you want to get detailed profiles for a set of companies you already know (such as getting the funding details of each company in a list). Use the Company Search API to find an undetermined number of companies that match your search criteria (such as finding fast-growing companies in a certain industry).

## Access & Billing

Any customer that has Company Enrich credits can use the Bulk Company Enrichment API.

We will deduct the number of remaining Company Enrichment credits in your account by the number of `200` status responses in a Bulk Enrichment request as though you made each request individually.

## Request Format

The endpoint for the bulk enrichment api is `POST https://api.peopledatalabs.com/v5/company/enrich/bulk`.

You can enrich up to 100 companies in a single request.

The request body must contain an array called `requests` with 1-100 individual request objects, each containing a `params` object for each request's parameters. See [Input Parameters - Company Enrichment API](https://docs.peopledatalabs.com/docs/input-parameters-company-enrichment-api) for details on the supported Enrichment API parameters.

| Field Name | Description                                  | Type             |
| ---------- | -------------------------------------------- | ---------------- |
| `requests` | All requests to make in the bulk enrichment. | `Array [Object]` |
| `params`   | The parameters for a single enrichment call. | `Object`         |

```json
{
  "requests": [
    {
      "params": {
        ...
      }
    },
    {
      "params": {
        ...
      }
    },
    ...
  ]
}
```

### Example

```python Python3
import requests
import json

# Set your API key
API_KEY = "YOUR API KEY"

# Pass your API key in header
HEADERS = {
    'X-Api-Key': API_KEY,
    'Content-Type': 'application/json',
}

# Create an array of parameters JSON objects
DATA = {
    "requests": [
        {
            "params": {
                "profile": "https://www.linkedin.com/company/walmart"
            }
        },
        {
            "params": {
                "website": "google.com"
            }
        }
    ]
}

# Pass the bulk parameters object to the Bulk Company Enrichment API using POST method
try:
    response = requests.post(
        'https://api.peopledatalabs.com/v5/company/enrich/bulk',
        headers=HEADERS,
        json=DATA
    )

    # Check if the request was successful (status code 200)
    if response.status_code == 200:
        # Parse the JSON response
        json_responses = response.json()

        # Iterate through the array of API responses
        for response_data in json_responses:

            # Check for successful response
            if response_data["status"] == 200:

                # Print selected fields
                print(
                    response_data['size'],
                    response_data['employee_count'],
                    response_data['industry'],
                    response_data['location']
                )
                print(f"Successfully enriched profile with PDL data.")

                # Save enrichment data to JSON file (append mode)
                with open(f"my_pdl_enrichment.{response_data['linkedin_slug']}.jsonl", "a") as out:
                    out.write(json.dumps(response_data) + "\n")
            else:
                print("Enrichment unsuccessful. See error and try again.")
                print("error:", response_data)
    else:
        print(f"Request failed with status code {response.status_code}")
except requests.exceptions.RequestException as e:
    print(f"An error occurred during the request: {e}")
```

```curl
curl -X POST "https://api.peopledatalabs.com/v5/company/enrich/bulk" \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: XXXX' \
-d ' {
    "requests": [
        {
            "params": {
                "profile": "https://www.linkedin.com/company/walmart"
            }
        },
            {
            "params": {
                "website": "google.com"
            }
        }
    ]
}'
```

## Response Format

Bulk Enrichment responses are a **JSON Array** of objects with the following fields:

| Field Name   | Description                 | Type      |
| ------------ | --------------------------- | --------- |
| `data`       | The person response object. | `Object`  |
| `status`     | The HTTP status code.       | `Integer` |
| `likelihood` | The likelihood score.       | `Integer` |

```json
[
	{"status": 200, "likelihood": 10, "data": ...},
	{"status": 200, "likelihood": 10, "data": ...}
]
```

The order the objects appear in the response list is the same as the order of the `params` in the input `requests` array.

Each response contains an individual status code that shows whether the enrichment for that particular request was successful (`200`) or not. See [Errors](https://docs.peopledatalabs.com/docs/errors) for a detailed breakdown on all possible status codes.

### Errors

If the request encounters an error, it will instead return an Error Response in the format described in [Errors](https://docs.peopledatalabs.com/docs/errors).