# Organisation

The organisation the token belongs to, the token's person, what they may do, and the audit log.

## List organisations

`GET /orgs`

Scope: `org:read`

The organisations this token may use. A personal token belongs to one organisation, so the list has that one.

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "4f1c2a8e-3b7d-4e0a-9c55-0d6f1e2a3b4c",
      "address": "acme",
      "name": "Acme",
      "time_zone": "Asia/Kolkata",
      "week_start": "monday",
      "date_format": "default",
      "working_hours_per_day": 8,
      "working_days_per_week": 5,
      "created_at": "2026-11-17T09:30:00.000Z",
      "plan": {
        "tier": "standard",
        "name": "Standard",
        "status": "active",
        "seats_used": 12,
        "seats_max": 100000
      }
    }
  ],
  "next_cursor": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Get an organisation

`GET /orgs/{org}`

Scope: `org:read`

The organisation's name, address, time zone, week start and working time. Owners and admins also get its plan and seats.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Query parameters

- `fields` (string): Only these fields, comma-separated: id, address, name, time_zone, week_start, date_format, working_hours_per_day, working_days_per_week, created_at, plan. id always comes; the fields not asked for are left out, required or not.

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "id": "4f1c2a8e-3b7d-4e0a-9c55-0d6f1e2a3b4c",
  "address": "acme",
  "name": "Acme",
  "time_zone": "Asia/Kolkata",
  "week_start": "monday",
  "date_format": "default",
  "working_hours_per_day": 8,
  "working_days_per_week": 5,
  "created_at": "2026-11-17T09:30:00.000Z",
  "plan": {
    "tier": "standard",
    "name": "Standard",
    "status": "active",
    "seats_used": 12,
    "seats_max": 100000
  }
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Get me

`GET /me`

Scope: `org:read`

The person the token acts for, their role in the token's organisation now, and the token's scopes and expiry.

### Request

```sh
curl -X GET "https://projqo.example/api/v1/me" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "id": "8d0e5f7a-1c2b-4d3e-8f9a-0b1c2d3e4f5a",
  "name": "Priya Shah",
  "email": "priya@example.com",
  "time_zone": "Asia/Kolkata",
  "language": "en-GB",
  "organisation": {
    "id": "4f1c2a8e-3b7d-4e0a-9c55-0d6f1e2a3b4c",
    "address": "acme",
    "name": "Acme"
  },
  "role": "member",
  "token": {
    "kind": "personal",
    "scopes": [
      "org:read",
      "tasks:read"
    ],
    "expires_at": "2027-03-01T09:30:00.000Z"
  }
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## Get my permissions

`GET /me/permissions`

Scope: `org:read`

What the token's person may do in the organisation, and with project= (a key or an id) in that project, so an app can hide what it can't do. A project the person can't see answers 404, as one that doesn't exist.

### Query parameters

- `project` (string): A project's key (WEB) or id. [1 to 60 characters]

### Request

```sh
curl -X GET "https://projqo.example/api/v1/me/permissions" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "organisation": [
    "browse_users",
    "create_team_project"
  ],
  "project": {
    "id": "1b2c3d4e-5f6a-4b7c-8d9e-0f1a2b3c4d5e",
    "key": "WEB",
    "permissions": [
      "browse",
      "create_tasks",
      "edit_tasks"
    ]
  }
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).

## List the audit log

`GET /orgs/{org}/audit-log`

Scope: `org:read`

The organisation's audit log, newest first, for its owners and admins: who did what, to what, when and from which address. Filter by person, action and time.

### Path parameters

- `org` (string, required): The organisation's id (or its address name). [1 to 100 characters]

### Query parameters

- `limit` (integer): How many items a page holds, 1 to 200. [from 1 to 200; default 50]
- `cursor` (string): The next_cursor of the previous page; leave it out for the first page. [at most 1000 characters]
- `count` (string): true adds total, the number of items in the whole list. [one of: true, false]
- `person` (string (uuid)): Only events by this person (their id).
- `action` (string): Only these actions, comma-separated (for example api_token_created,api_token_revoked). [at most 500 characters]
- `since` (string (date-time)): Only events at or after this time.
- `until` (string (date-time)): Only events before this time.
- `fields` (string): Only these fields, comma-separated: id, at, actor, action, category, summary, item, ip, details. id always comes; the fields not asked for are left out, required or not.

### Request

```sh
curl -X GET "https://projqo.example/api/v1/orgs/{org}/audit-log" \
  -H "Authorization: Bearer $PROJQO_TOKEN"
```

### Answer: 200

```json
{
  "items": [
    {
      "id": "0a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
      "at": "2026-12-01T10:15:00.000Z",
      "actor": {
        "kind": "person",
        "id": "8d0e5f7a-1c2b-4d3e-8f9a-0b1c2d3e4f5a",
        "name": "Priya Shah"
      },
      "action": "api_token_created",
      "category": "API",
      "summary": "Made an API token",
      "item": {
        "kind": "api_token",
        "id": "5e6f7a8b-9c0d-4e1f-8a2b-3c4d5e6f7a8b",
        "name": null
      },
      "ip": "203.0.113.7",
      "details": {
        "name": "Nightly report",
        "scopes": [
          "tasks:read"
        ]
      }
    }
  ],
  "next_cursor": null
}
```

### Errors

- 400 `invalid`: invalid: A value is wrong or missing, or a parameter is unknown. Every problem is in details.
- 401 `invalid_token`: invalid_token: No token was sent, or it is wrong, expired or revoked, or its person is no longer a member (or is now a guest).
- 403 `insufficient_scope`: insufficient_scope: The token doesn't have the scope this call needs (named in WWW-Authenticate). api_off: The organisation's admins have switched the API off. suspended: projqo has suspended the organisation. refused: The token's person can see the thing but may not do this; the message says why.
- 404 `not_found`: not_found: Nothing is at this address, or the token's person can't see it: the answer is the same.
- 429 `rate_limited`: rate_limited: Too many calls in this minute, for the token or for the whole organisation.
- 500 `internal`: internal: Something went wrong on projqo's side (never your mistake).
