# Available Data

List available data categories for a company.

Returns counts of available data records across different categories for the specified company.

## Endpoint

```text
GET /api/v1/companies/:company_id/data
```

## Parameters

| Parameter | Type | In | Description |
| --- | --- | --- | --- |
| `company_id` | `integer` | path | The unique identifier of the company. |

## Code Examples

**Get available data**

**Python**

```python
import requests

url = 'https://statsnet.co/api/v1/companies/12345/data'
headers = {
  'Authorization': 'Bearer sk_live_YOUR_KEY',
  'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers).json()
print(response)
```

**TypeScript**

```typescript
const url = 'https://statsnet.co/api/v1/companies/12345/data';

const response = await fetch(url, {
headers: {
  'Authorization': 'Bearer sk_live_YOUR_KEY',
  'Content-Type': 'application/json',
},
});

const data = await response.json();
console.log(data);
```

**Go**

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {
	url := "https://statsnet.co/api/v1/companies/12345/data"

	req, _ := http.NewRequest("GET", url, nil)
	req.Header.Set("Authorization", "Bearer sk_live_YOUR_KEY")
	req.Header.Set("Content-Type", "application/json")

	client := &http.Client{}
	resp, _ := client.Do(req)
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
```

## Response

The response body has no `{"ok": ...}` envelope: top-level keys are the record arrays per category plus a `meta` object with per-category counts. The arrays are populated only when the company view has been purchased (otherwise they come back empty/`null`); the counts in `meta` are always present.

**Success response**

```json
{
  "bank_accounts": [],
  "stores": [],
  "certs": [],
  "debtors": [],
  "jobs": [],
  "quasi_contracts": [],
  "places": [],
  "states": [],
  "pos_terminals": [],
  "domains": [],
  "scoring": [],
  "gov_loans": [],
  "trademarks": [],
  "counterparties": [],
  "kaspi_shops": [],
  "assets": [{ "type": "vehicle" }],
  "rights": [],
  "farmers": [],
  "fields": [],
  "counterparties_count": 12,
  "meta": {
    "bank_accounts_count": 3,
    "stores_count": 0,
    "certs_count": 2,
    "debtors_count": 1,
    "quasi_contracts_count": 0,
    "jobs_count": 5,
    "places_count": 0,
    "states_count": 0,
    "pos_terminals_count": 0,
    "domains_count": 1,
    "scoring_count": 0,
    "assets_count": 1,
    "rights_count": 0,
    "farmers_count": 0,
    "fields_count": 0,
    "gov_loans_count": 0,
    "trademarks_count": 0,
    "counterparties_count": 12,
    "kaspi_count": 0
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `bank_accounts`, `stores`, `certs`, `debtors`, `jobs`, `quasi_contracts`, `places`, `states`, `pos_terminals`, `domains`, `scoring`, `gov_loans`, `trademarks`, `counterparties`, `kaspi_shops`, `rights`, `farmers`, `fields` | `array` | Record lists per data category. |
| `assets` | `array` | Asset types derived from tax data (`vehicle`, `realty`, `land plot`). |
| `counterparties_count` | `integer` | Number of counterparty records. |
| `meta` | `object` | Per-category record counts (`*_count`). |

## Error Handling

Errors are returned as `{"status": <HTTP code>, "message": "<text>"}`.

**Error response**

```json
{
  "status": 403,
  "message": "access denied"
}
```
