# Departments

Get department information for a company.

Returns department/division information for the specified company.

## Endpoint

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

## Parameters

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

## Code Examples

**Get departments**

**Python**

```python
import requests

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

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

	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
{
  "identifier": "400500600",
  "jurisdiction": "kz",
  "departments": [
    "State Revenue Department for Almaty",
    "Department of Ecology"
  ]
}
```

If no department record exists for the company, an empty object is returned with `200 OK`:

**Empty response**

```json
{
  "identifier": "",
  "jurisdiction": "",
  "departments": null
}
```

## Error Handling

**Error response (403)**

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

**Payment required (402)**

```json
{
  "status": 402,
  "message": "payment required"
}
```

**Quota exhausted (429)**

```json
{
  "status": 429,
  "message": "quota exhausted"
}
```
