# Companies with their visits and page views (https://webmetic.de/docs/api/referenz/visitor-intelligence/company-sessions)

## GET /company-sessions

Retrieves detailed company information and associated visitor session data for a specified domain within a given time range.
This is a full export of all sessions combined with all the data. If you want to have single entities please check out the other endpoints.

### Description:
This endpoint provides comprehensive data about companies and their visitor sessions for a specified domain. It offers insights into both company details and user engagement metrics, helping you understand not only user behavior but also the companies interacting with your domain.

#### Authentication:
* To access this endpoint, you need to provide a valid API key.
* The API key is validated using the `get_api_key` dependency.
* If the API key is missing, invalid, or unauthorized, the endpoint will return an appropriate error response.

#### Rate Limiting:
* This endpoint is rate-limited to 1 request per second.
* If you exceed the rate limit, you will receive a 429 (Too Many Requests) response.

#### Parameters:
* **domain** (required, str): The domain name for which you want to retrieve visitor sessions.
* **from_date** (optional, str): The starting date and time of the session data range. You can provide an ISO 8601 formatted datetime string or relative dates like '-30 days'. Default is '-30 days'.
* **to_date** (optional, str): The ending date and time of the session data range. You can provide an ISO 8601 formatted datetime string or 'now' for the current date and time. Default is 'now'.
* **page** (optional, int): The page number of the results to retrieve. Default is 1.
* **page_size** (optional, int): The number of entries to retrieve per page, up to a maximum of 10000. Default is 10000.

#### Notes

* The endpoint uses timezone 'Europe/Berlin' by default.
* The default locale is 'de-DE'.

**Returns:**
* A JSON object containing the paginated visitor session data based on the specified filters.

For more information and detailed usage instructions, please refer to the API documentation at www.webmetic.de.

### Parameter

| Name | Ort | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- | --- |
| `domain` | query | string | ja |  |
| `from_date` | query | string | nein | Starting DateTime format or relative dates like '-30 days', '-1 hour', '-5 minutes'. Examples: '2023-01-01', '-7 days', '-12 hours', '-5 minutes', 'now' |
| `to_date` | query | string | nein | Ending DateTime format or 'now' for the current date/time. Examples: '2023-01-31', 'now' |
| `page` | query | integer | nein | Selected result page, starting at 1 |
| `page_size` | query | integer | nein | Number of entries per page, from 1 up to a maximum of 10000 |

### Antworten

| Status | Beschreibung |
| --- | --- |
| 200 | Companies with their visits and page views; missing fields are absent |
| 400 | INVALID_DATE: from_date or to_date cannot be read |
| 403 | API_KEY_MISSING, API_KEY_INVALID, API_KEY_NOT_FOUND, or API_KEY_NOT_AUTHORIZED: the domain is not a website of your account (send it exactly as listed there) |
| 422 | VALIDATION_ERROR: a parameter is missing or out of range (page from 1, page_size 1 to 10000); `errors` lists each problem |
| 429 | RATE_LIMITED: more than one request per second to this endpoint |
| 500 | INTERNAL_ERROR: unexpected server error |

Felder der Antwort 200:

| Feld | Typ | Pflicht | Beschreibung |
| --- | --- | --- | --- |
| `pagination` | Pagination[] | ja | Always one entry |
| `pagination[].total` | integer | ja | Entries over all pages |
| `pagination[].page_total` | integer | ja | Number of pages; 0 on an empty result |
| `pagination[].isFirst` | boolean | ja | true on page 1 |
| `pagination[].current` | integer | ja | This page, from 1 |
| `pagination[].isLast` | boolean | ja | true when current >= page_total, also on an empty result |
| `pagination[].page_size` | integer | ja | Entries per page as requested |
| `result` | CompanyWithSessions[] | ja | Companies with their visits and page views in the date range |
| `result[].company_id` | string \| null | nein | Webmetic's id of the company (12 characters). /contacts takes it. |
| `result[].company_name` | string \| null | nein | Company name. On Free a hidden company reads 'Verborgenes Unternehmen'. |
| `result[].company_url` | string \| null | nein | Website of the company |
| `result[].company_logo_url` | string \| null | nein | URL of the company logo |
| `result[].organization_type` | string \| null | nein | Kind of organization, e.g. business or academic (not the legal form) |
| `result[].address` | string \| null | nein | Street and number of the company seat |
| `result[].postal_code` | string \| null | nein | Postal code of the company seat |
| `result[].city` | string \| null | nein | City of the company seat |
| `result[].country` | string \| null | nein | Country of the company seat, as a name |
| `result[].country_code` | string \| null | nein | Country of the company seat, ISO 3166-1 alpha-2 |
| `result[].directors` | string[] \| null | nein | Managing directors from the imprint |
| `result[].phone_number` | string \| null | nein | General phone number of the company |
| `result[].fax_number` | string \| null | nein | Fax number of the company |
| `result[].email_address` | string \| null | nein | General email address of the company |
| `result[].email_pattern` | string \| null | nein | Opaque code of the company's most common e-mail address format, e.g. p1 |
| `result[].email_pattern_confidence` | number \| null | nein | Confidence of email_pattern, 0 to 100 with one decimal |
| `result[].employee_count` | (integer \| null)[] \| null | nein | Employees as a range [min, max]; max null means open-ended |
| `result[].revenue` | (number \| null)[] \| null | nein | Annual revenue in euros as a range [min, max]; max null means open-ended |
| `result[].vat_id` | string \| null | nein | VAT identification number |
| `result[].tax_number` | string \| null | nein | Tax number |
| `result[].registration_number` | string \| null | nein | Commercial register number |
| `result[].registration_court` | string \| null | nein | Register court |
| `result[].primary_color` | string \| null | nein | Main brand color from the logo, hex |
| `result[].secondary_color` | string \| null | nein | Second brand color from the logo, hex |
| `result[].lead_score` | number \| null | nein | Activity of the company's visits, 0 to 100 |
| `result[].fit_score` | integer \| null | nein | Match against the domain's ideal customer profile, 0 to 100; null without a profile |
| `result[].relevance_score` | number \| null | nein | fit_score × lead_score / 100, equals lead_score without a profile. Rank by this. |
| `result[].linkedin` | string \| null | nein | LinkedIn page of the company |
| `result[].facebook` | string \| null | nein | Facebook page of the company |
| `result[].instagram` | string \| null | nein | Instagram account of the company |
| `result[].youtube` | string \| null | nein | YouTube channel of the company |
| `result[].twitter` | string \| null | nein | X (Twitter) account of the company |
| `result[].short_description_de` | string \| null | nein | Short description in German |
| `result[].short_description_en` | string \| null | nein | Short description in English |
| `result[].full_description_de` | string \| null | nein | Long description in German |
| `result[].full_description_en` | string \| null | nein | Long description in English |
| `result[].what_they_do_de` | string \| null | nein | What the company does, in German |
| `result[].what_they_do_en` | string \| null | nein | What the company does, in English |
| `result[].how_they_make_money_de` | string \| null | nein | How the company makes money, in German |
| `result[].how_they_make_money_en` | string \| null | nein | How the company makes money, in English |
| `result[].target_audience_de` | string \| null | nein | Who the company sells to, in German |
| `result[].target_audience_en` | string \| null | nein | Who the company sells to, in English |
| `result[].nace_codes` | NaceCode[] \| null | nein | Industry codes, NACE Rev. 2.1 |
| `result[].wz2025_codes` | NaceCode[] \| null | nein | Industry codes, German WZ 2025, same shape as nace_codes |
| `result[].industry_categories` | string[] \| null | nein | Webmetic industry categories, e.g. industrie_fertigung |
| `result[].blurred` | boolean \| null | nein | Only on Free, for a company past the month's readable ones: true, and only the ids and visit times are given |
| `result[].sessions` | Session[] \| null | nein | The company's visits in the date range |

### Beispiel

```bash
curl -X GET 'https://hub.webmetic.de/company-sessions?domain=website.example' \
  -H 'Authorization: wmtc_IHR_API_SCHLUESSEL'
```