# Authorization

## Authorization key

To start using our API, you need an API Key. You can get the API Key from Coresignal's [self-service platform](https://dashboard.coresignal.com/sign-in). Moreover, your account manager or sales representative can generate the key for you upon your request for the API plan.

***

## Authorization header

All requests must contain an `API Key` header. Its value is your unique API Key.

{% code title="Authorization header" %}

```json
-H “apikey: "API_Key"”
```

{% endcode %}

## cURL authorization

Several examples of authorization in cURL are given according to the required request. Here, requests are made using Base Company API endpoints.

{% code title="Elasticsearch DSL" %}

```json
curl -X 'POST' \
'https://api.coresignal.com/cdapi/v2/company_base/search/es_dsl' \
  -H 'accept: application/json' \
  -H 'apikey: "API_Key"' \
  -H 'Content-Type: application/json' \
  -d '{
   //insert your query
}'
```

{% endcode %}

## General authorization templates

Templates for authentication in various programming languages and programming environment.

{% tabs %}
{% tab title="Python" %}

```python
import requests

api_endpoint = "API_ENDPOINT"
api_key = "API_Key"

headers = {
    "apikey": api_key
}

response = requests.get(api_endpoint, headers=headers)

# Print the response content or handle it as needed
print(response.text)
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'net/http'
require 'uri'

uri = URI.parse("API_ENDPOINT")
http = Net::HTTP.new(uri.host, uri.port)

request = Net::HTTP::Get.new(uri.request_uri)
api_key = "API_Key"
request['apikey'] = api_key

response = http.request(request)
puts response.body
```

{% endtab %}

{% tab title="Node.js" %}

```nodejs
const https = require('https');

const apiEndpoint = 'API_ENDPOINT';
const apiKey = "API_Key";

const options = {
    headers: {
        'apikey': apiKey
    }
};

https.get(apiEndpoint, options, (response) => {
    let data = '';
    response.on('data', (chunk) => {
        data += chunk;
    });

    response.on('end', () => {
        console.log(data);
    });
});
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$apiEndpoint = "API_ENDPOINT";
$apiKey = "API_Key";

$options = [
    'http' => [
        'header' => "apikey: $apiKey"
    ]
];

$context = stream_context_create($options);
$response = file_get_contents($apiEndpoint, false, $context);
?>
```

{% endtab %}
{% endtabs %}

Use any API-compatible tool to authorize and start querying the API.

## FAQ

<details>

<summary>Where can I find my API Key?</summary>

API Key is stored in the [self-service platform](https://dashboard.coresignal.com/sign-in) home page's `API Keys` section.

</details>

<details>

<summary>How do I use API Key?</summary>

1. Change your authorization request header's to API Key: `-H 'apikey: "API_Key"'`\
   Here, insert your API Key instead of `"API_Key"`
2. Make sure that you are using the correct endpoints. For example: `/v2/company_base/search/es_dsl`

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coresignal.com/api-introduction/authorization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
