# Government Contracts

Get government contract records for a company.

Returns a paginated list of government procurement contracts where the specified company is either a supplier or customer.

## Endpoint

```text
GET /api/v1/companies/:company_id/gov-contracts
```

## 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 government contracts**

**Python**

```python
import requests

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

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/gov-contracts"

	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
{
  "government_contract": [
    {
      "id": 1,
      "trd_buy_number_anno": "TRD-2024-001",
      "trd_buy_name_ru": "Закупка оборудования",
      "contract_number": "CNT-2024-001",
      "fin_year": "2024",
      "is_gu": false,
      "ref_currency_code": "KZT",
      "contract_sum": 15000000,
      "contract_sum_wnds": 16800000,
      "sign_date": "2024-01-15",
      "contract_end_date": "2024-12-31",
      "supplier_biin": "302233483",
      "supplier_name": "Company Name LLC",
      "supplier_statsnet_id": "12345",
      "customer_bin": "100000001",
      "customer_name": "Government Agency",
      "customer_statsnet_id": "67890",
      "jurisdiction": "kz"
    }
  ]
}
```

## Error Handling

**Error response**

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

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