# Licenses

Get license records for a company.

Returns a paginated list of licenses held by the specified company.

## Endpoint

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

## Parameters

| Parameter | Type | In | Description |
| --- | --- | --- | --- |
| `company_id` | `integer` | path | The unique identifier of the company. |
| `page` | `integer` | query | Page number (default: 1). |
| `limit` | `integer` | query | Records per page (default: 100). |

## Code Examples

**Get licenses**

**Python**

```python
import requests

url = 'https://statsnet.co/api/v1/companies/12345/licenses'
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/licenses';

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/licenses"

	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

**Success response**

```json
{
  "licenses": [
    {
      "id": 1,
      "identifier": "302233483",
      "name": "Company Name LLC",
      "license_number": "LIC-2024-001",
      "application_number": null,
      "status": "active",
      "category": "construction",
      "industries": null,
      "licensor_name": "Ministry of Industry",
      "jurisdiction": "kz",
      "start_date": "2024-01-01T00:00:00Z",
      "end_date": "2027-01-01T00:00:00Z"
    }
  ],
  "total": 1,
  "pagination_total": 1,
  "pagination_offset": 0
}
```

## Error Handling

**Error response**

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

This endpoint can also return `{"status": 402, "message": "payment required"}` when the subscription is canceled or expired, and `{"status": 429, "message": "quota exhausted"}` when the plan’s report quota for the current period is used up.
