# POST Requests

## Endpoints usage

Learn how to make Search filters or Elasticsearch DSL requests for data in bulk.&#x20;

1. Prepare your request using the template below:

* Enter `{entity}` of the used endpoint
* Insert your API Key instead of `{API Key}`&#x20;
* Input required search filters in the `"filters": {}` section or Elasticsearch DSL filters in the `"es_dsl_query": {}` section
* Input your webhook URL instead of `{optional_webhook_url}`&#x20;
* Input the required number of records instead of `{optional_integer}` by limit parameter

{% hint style="success" %}
Keep in mind that parameters `webhook_url` and `limit` are **optional.**
{% endhint %}

{% tabs %}
{% tab title="Search filters template" %}
{% code title="Request body template" %}

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/data_requests/{entity}/filter' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "webhook_url": "{optional_webhook_url}",
   "limit": {optional_integer},
   "filters": {}
}'
```

{% endcode %}
{% endtab %}

{% tab title="Elasticsearch DSL" %}
{% code title="Request body template" %}

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/data_requests/{entity}/es_dsl' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "webhook_url": "{optional_webhook_url}",
   "limit": {optional_integer}
   "es_dsl_query": {}
}'
```

{% endcode %}
{% endtab %}
{% endtabs %}

2. Import the cURL to any API-compatible application.
3. Send the request.
4. Retrieve the request ID from the response body:

{% code title="Request ID example" %}

```json
{
  "request_id": "433869ec-0a98-4dcd-9b13-db4df58260f5"
}
```

{% endcode %}

* `Location` response header provides a URL where the results can be retrieved.

> Location: /v2/data\_requests/e000b0ec-0f00-0b00-0a0a-0b00fa0000d0/files

***

### IDs request

Part of entities support endpoint `/v2/data_requests/{entity}/ids` , when you must submit a list of IDs to the request to receive data in bulk. Please review the API information to see the supported endpoint.

1. Prepare your request using the template below:

* Enter `{entity}` of the used endpoint
* Enter your API Key instead of `{Api Key}` and, optionally, webhook URL in the cURL request template

{% code title="cURL request" %}

```json
curl -X 'POST' \
  'https://api.coresignal.com/cdapi/v2/data_requests/{entity}/ids' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: multipart/form-data' \
  -F 'webhook_url={optional_webhook_url}' \
  -F 'ids={list of ids}'
```

{% endcode %}

2. Import the edited cURL request to Postman or any other API-compatible application.
3. Send the request.
4. Retrieve the `request_id` from the response body:

{% code title="Request ID" %}

```json
{
  "request_id": "433869ec-0a98-4dcd-9b13-db4df58260f5"
}
```

{% endcode %}

* `Location` response header provides a URL where the results can be retrieved.

> Location: /v2/data\_requests/e000b0ec-0f00-0b00-0a0a-0b00fa0000d0/files

### ID File requests

{% hint style="info" %}
Notice that in Base Employee API IDs are passed as a list
{% endhint %}

Part of entities support endpoint `/v2/data_requests/{entity}/id_file` , when you must submit a list of IDs in a .csv or .txt file to request data in bulk. Please review the API information to see the supported endpoint.&#x20;

Example for the ID list formatting:

<details>

<summary>ID list example</summary>

<table data-header-hidden><thead><tr><th valign="top"></th></tr></thead><tbody><tr><td valign="top">1</td></tr><tr><td valign="top">2</td></tr><tr><td valign="top">3</td></tr></tbody></table>

</details>

1. Prepare the IDs file in a .csv or .txt format. Make sure the list only contains numeric IDs.

{% hint style="warning" %}
Avoid any additional headings in the file. The request will fail if non-numeric data is present in the file.
{% endhint %}

2. Prepare your request using the template below:

* Enter `{entity}` of the used endpoint
* Enter your API Key instead of `{Api Key}` and, optionally, webhook URL in the cURL request template

{% code title="cURL request" %}

```json
curl -X 'POST' \
  'https://api.coresignal.com/cdapi/v2/data_requests/{entity}/id_file' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: multipart/form-data' \
  -F 'ids_file=@id_list_example.csv;type=text/csv' \
  -F 'webhook_url={optional_webhook_url}'
```

{% endcode %}

3. Import the edited cURL request to Postman or any other API-compatible application.

{% hint style="warning" %}
Further instructions are for the POST requests using Postman.
{% endhint %}

4. Open **Body** tab and upload the IDs file by clicking the **Select Files** button in the **Value** column:

![](https://archbee-image-uploads.s3.amazonaws.com/iNaodsHbfav9t72Jx5JdM/ul9u1uIOy47oNnmtF1S7r_screenshot-2023-08-24-at-122855.png)

5. Send the request.
6. Retrieve the `request_id` from the response body:

{% code title="Request ID" %}

```json
{
  "request_id": "433869ec-0a98-4dcd-9b13-db4df58260f5"
}
```

{% endcode %}

* `Location` response header provides a URL where the results can be retrieved.

> Location: /v2/data\_requests/e000b0ec-0f00-0b00-0a0a-0b00fa0000d0/files

***

### Shorthand names and URLs requests

{% hint style="warning" %}
This section is used for [Clean Employee API](https://docs.coresignal.com/employee-api/clean-employee-api) and [Base Employee API](https://docs.coresignal.com/employee-api/base-employee-api) indexes&#x20;
{% endhint %}

You can send up to 10,000 `shorthand_names` or `URLs` per request.&#x20;

Requirements for `shorthand_names` are listed below:

* Must not be an empty string (`""`)
* Must not contain capital letters
* Must not have leading or trailing spaces (`" john-doe "`)
* Most special characters are not allowed
* Length must be between 3 and 100 characters

#### Endpoint usage

1. Prepare your request using the template below:

* Enter `{entity}` of the used endpoint
* Input the required data in the `"shorthand_names": []` or `"urls": []` section
* Insert your API Key instead of `{API Key}`

{% tabs %}
{% tab title="Template for shorthand\_names" %}
{% code title="Request body template for shorthand\_names" %}

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/data_requests/{entity}/shorthand_names' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
  "webhook_url": "{optional_webhook_url}",
  "shorthand_names": []
  }'
```

{% endcode %}
{% endtab %}

{% tab title="Template for urls" %}

```json
curl -X 'POST' \
  'https://api.coresignal.com/cdapi/v2/data_requests/{entity}/urls' \
  -H 'accept: application/json' \
  -H 'apikey: {API Key}' \
  -H 'Content-Type: application/json' \
  -d '{
   "webhook_url": "{optional_webhook_url}",
   "urls": []
   }'
```

{% endtab %}
{% endtabs %}

2. Import the cURL to any API-compatible application.
3. Send the request.
