# Accounts reference

> The daily accounts feed, the tally between companies and payroll hours, for a ledger.

Source: https://docs.orkero.app/reference/accounts

The daily accounts feed, the tally between companies and payroll hours, for a ledger.

| Request | What it does | Scope |
| --- | --- | --- |
| [`GET /v1/accounts/days`](#listaccountsdays) | Read each day's accounts figures | `accounts.feed` |
| [`GET /v1/accounts/between-companies`](#getbetweencompanies) | Read the tally between companies | `accounts.tally` |
| [`GET /v1/payroll/hours`](#getpayrollhours) | Read each person's hours for a pay period | `payroll.hours` |

## Read each day's accounts figures

`GET /v1/accounts/days`

For a ledger or accountant's system. Fields are in docs/api-guide.md, section 4.

Scope: `accounts.feed`.

### Query

| Name | Type | Needed | What it is |
| --- | --- | --- | --- |
| `from` | string (date) |  |  |
| `to` | string (date) |  |  |
| `practice_id` | string |  | One practice, several (repeat it, or separate with commas), or none for every practice the key covers. |
| `since` | string (date‑time) |  |  |
| `revisions` | string |  | One of `latest`, `all`. Default `latest`. |

### Example

```bash
curl "https://api.orkero.app/v1/accounts/days" \
  -H "Authorization: Bearer $ORKERO_KEY"
```
```typescript
const res = await fetch("https://api.orkero.app/v1/accounts/days", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.ORKERO_KEY}`,
  },
});
const answer = await res.json();
```
```python
import os, requests

res = requests.get(
    "https://api.orkero.app/v1/accounts/days",
    headers={"Authorization": f"Bearer {os.environ['ORKERO_KEY']}"},
)
answer = res.json()
```

### Answer (200)

```json
{
  "ok": true,
  "request_id": "web-000123"
}
```

### Errors

| Status | When |
| --- | --- |
| 401 | `no_such_key`, `key_switched_off`, `key_ended`. |
| 403 | `not_allowed` (the key lacks the scope), `not_your_practice`, `whole_organisation`. |
| 409 | `booking_off`, `feedback_off`, `time_gone`, `too_late`, `booking_cancelled`, `booking_past`, `voice_off`. |
| 422 | A field is wrong; the message says which and why. `refused` carries words for the person booking. |

## Read the tally between companies

`GET /v1/accounts/between-companies`

Scope: `accounts.tally`.

### Query

| Name | Type | Needed | What it is |
| --- | --- | --- | --- |
| `from` | string (date) |  |  |
| `to` | string (date) |  |  |

### Example

```bash
curl "https://api.orkero.app/v1/accounts/between-companies" \
  -H "Authorization: Bearer $ORKERO_KEY"
```
```typescript
const res = await fetch("https://api.orkero.app/v1/accounts/between-companies", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.ORKERO_KEY}`,
  },
});
const answer = await res.json();
```
```python
import os, requests

res = requests.get(
    "https://api.orkero.app/v1/accounts/between-companies",
    headers={"Authorization": f"Bearer {os.environ['ORKERO_KEY']}"},
)
answer = res.json()
```

### Answer (200)

```json
{
  "ok": true,
  "request_id": "web-000123"
}
```

### Errors

| Status | When |
| --- | --- |
| 401 | `no_such_key`, `key_switched_off`, `key_ended`. |
| 403 | `not_allowed` (the key lacks the scope), `not_your_practice`, `whole_organisation`. |

## Read each person's hours for a pay period

`GET /v1/payroll/hours`

Scope: `payroll.hours`.

### Query

| Name | Type | Needed | What it is |
| --- | --- | --- | --- |
| `from` | string (date) |  |  |
| `to` | string (date) |  |  |

### Example

```bash
curl "https://api.orkero.app/v1/payroll/hours" \
  -H "Authorization: Bearer $ORKERO_KEY"
```
```typescript
const res = await fetch("https://api.orkero.app/v1/payroll/hours", {
  method: "GET",
  headers: {
    Authorization: `Bearer ${process.env.ORKERO_KEY}`,
  },
});
const answer = await res.json();
```
```python
import os, requests

res = requests.get(
    "https://api.orkero.app/v1/payroll/hours",
    headers={"Authorization": f"Bearer {os.environ['ORKERO_KEY']}"},
)
answer = res.json()
```

### Answer (200)

```json
{
  "ok": true,
  "request_id": "web-000123"
}
```

### Errors

| Status | When |
| --- | --- |
| 401 | `no_such_key`, `key_switched_off`, `key_ended`. |
| 403 | `not_allowed` (the key lacks the scope), `not_your_practice`, `whole_organisation`. |
