{"openapi":"3.1.0","info":{"title":"marve-py-organisation-service","version":"0.1.0"},"paths":{"/organisations/invite":{"get":{"tags":["Invites"],"summary":"List invites","description":"Everybody but a super admin sees only their own organisation's invites. `status` is `FAILED` for an invite whose 7 days ran out: its link is dead and its seat is free. `PATCH .../resend` gives it another 7 days if a seat is free. The `status` filter reads the stored status, which catches up within the hour.\n\nPaged: `page` (or `page=all` for everything) and `ordering=field` / `ordering=-field`. `all` searches every field. Any other query parameter is an exact filter, with `true`/`false` read as booleans.","operationId":"get_all_invites_organisations_invite_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Page number, or `all` for no paging.","examples":["1"],"title":"Page"},"description":"Page number, or `all` for no paging."},{"name":"ordering","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`field` ascending, `-field` descending. Default `-created_at_timestamp`.","examples":["-created_at_timestamp"],"title":"Ordering"},"description":"`field` ascending, `-field` descending. Default `-created_at_timestamp`."},{"name":"all","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search across every field.","title":"All"},"description":"Search across every field."},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"e.g. `PENDING` or `ACCEPTED`.","examples":["PENDING"],"title":"Status"},"description":"e.g. `PENDING` or `ACCEPTED`."},{"name":"email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial, case-insensitive.","title":"Email"},"description":"Partial, case-insensitive."},{"name":"role","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"e.g. `user` or `organisation_admin`.","title":"Role"},"description":"e.g. `user` or `organisation_admin`."},{"name":"organisation_reference","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Super admins only; everybody else always sees their own organisation's invites.","title":"Organisation Reference"},"description":"Super admins only; everybody else always sees their own organisation's invites."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"reference":{"type":"string"},"organisation":{"type":"object","properties":{"organisation_reference":{"type":"string"},"organisation_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organisation_reference"],"additionalProperties":true},"email":{"type":"string"},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"initiating_organisation":{"type":"object","properties":{"organisation_reference":{"type":"string"},"organisation_name":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organisation_reference"],"additionalProperties":true},"status":{"type":"string","description":"`FAILED` is an invite whose 7 days ran out: its link is dead and its seat is free."},"created_by_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]},"user_reference":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["reference","organisation","email","initiating_organisation","status"],"additionalProperties":true}},"pagination":{"type":"object","properties":{"current_page":{"type":"integer"},"page_size":{"type":"integer"},"total_records":{"type":"integer"},"total_pages":{"type":"integer"},"has_next":{"type":"boolean"},"has_previous":{"type":"boolean"}},"required":["current_page","page_size","total_records","total_pages","has_next","has_previous"],"additionalProperties":true}},"required":["items","pagination"],"additionalProperties":true},"example":{"items":[{"reference":"22222222-2222-2222-2222-222222222222","organisation":{"organisation_reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine"},"email":"new.starter@example.com","role":"user","initiating_organisation":{"organisation_reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine"},"status":"PENDING","created_by_reference":"44444444-4444-4444-4444-444444444444","created_at_timestamp":"2026-09-30T11:16:53.238310"}],"pagination":{"current_page":1,"page_size":10,"total_records":1,"total_pages":1,"has_next":false,"has_previous":false}}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Invites"],"summary":"Invite people by email","description":"Administrators only. Each `mailing_list` entry is an email, or `{\"email\", \"role\"}` (role defaults to `user`). Leave out `products` to grant every product the organisation holds; named products are the only ones the person is seated on when they accept. Seats are checked per product (400 when full). 409 if somebody invited already belongs to this or another organisation, or `organisation_admin` is offered when the organisation has one or an invitation is offering it. `organisation_reference` is for super admins only; an organisation admin leaves it out and their own is used.","operationId":"invite_users_organisations_invite_post","security":[{"HTTPBearer":[]}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"mailing_list":{"type":"array","items":{"anyOf":[{"type":"string"},{"type":"object","additionalProperties":{"type":"string"}}]}},"organisation_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}]}},"required":["mailing_list"],"additionalProperties":true},"example":{"mailing_list":["new.starter@example.com",{"email":"team.lead@example.com","role":"organisation_admin"}],"products":["prod-polpred"]}}}}}},"/organisations/invite/{reference}":{"get":{"tags":["Invites"],"summary":"Read one invite","description":"The stored invite, including the products it grants and `expires_at_timestamp`. Still answers 200 once it has run out, with `status` `FAILED`.","operationId":"get_invite_by_reference_organisations_invite__reference__get","parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"},"organisation_reference":{"type":"string"},"organisation_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"type":"string"},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"initiating_organisation_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"initiating_organisation_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"new_user":{"type":"boolean"},"status":{"type":"string"},"created_by_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]},"user_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"type":"array","items":{"type":"string"}},"expires_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["reference","organisation_reference","email","new_user","status"],"additionalProperties":true},"example":{"reference":"22222222-2222-2222-2222-222222222222","organisation_reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine","email":"new.starter@example.com","role":"user","initiating_organisation_reference":"11111111-1111-1111-1111-111111111111","initiating_organisation_name":"Acme Marine","new_user":true,"status":"PENDING","created_by_reference":"44444444-4444-4444-4444-444444444444","created_at_timestamp":"2026-09-30T11:16:53.238310","products":["prod-polpred"],"expires_at_timestamp":"2026-10-07T11:16:53.238310"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organisations/health":{"get":{"tags":["Health"],"summary":"Health check","operationId":"health_organisations_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"message":{"type":"string"}},"additionalProperties":true,"type":"object","required":["message"]},"example":{"message":"marve-py-organisation-service is okay and running, fast!"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}}}}},"/organisations/signup":{"post":{"tags":["Organisations"],"summary":"Start an organisation signup","description":"`email` must be the signed-in user's own address. Sends a one-time code whose reference is then passed to create the organisation.","operationId":"signup_organisation_organisations_signup_post","requestBody":{"content":{"application/json":{"schema":{"properties":{"email":{"type":"string"},"invite_reference":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["email"]},"example":{"email":"jane@example.com"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"reference":{"type":"string"}},"additionalProperties":true,"type":"object","required":["reference"]},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}}},"security":[{"HTTPBearer":[]}]}},"/organisations/users/add":{"post":{"tags":["Members"],"summary":"Add people who already have an account","description":"Administrators only. Each `user_references` entry is a user reference, or `{\"reference\", \"role\"}`, where `reference` is the person's account reference (the `reference` on their record from `GET /users`); an entry without one is a 400. Somebody joining as `organisation_admin` when the organisation has one is a 409. Somebody in no organisation joins at once, with nothing to accept. Somebody already in this organisation is given any requested product they lack. Somebody in another organisation is a 409. Leave out `products` to grant every product the organisation holds. Seats are checked per product (400 when full). `organisation_reference` is for super admins only; an organisation admin leaves it out and their own is used.","operationId":"add_existing_users_organisations_users_add_post","requestBody":{"content":{"application/json":{"schema":{"properties":{"user_references":{"items":{"anyOf":[{"type":"string"},{"properties":{"reference":{"type":"string"},"role":{"type":"string"}},"type":"object","required":["reference"]}]},"type":"array"},"organisation_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["user_references"]},"example":{"user_references":["33333333-3333-3333-3333-333333333333"],"products":["prod-polpred"]}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"reference":{"type":"string"}},"additionalProperties":true,"type":"object","required":["reference"]},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}}},"security":[{"HTTPBearer":[]}]}},"/organisations/invite/{reference}/delete":{"delete":{"tags":["Invites"],"summary":"Withdraw an invite","description":"The administrator who sent it, or any `super_admin`. Frees the seat it was holding, including one provisioning put on the licence.","operationId":"delete_invite_organisations_invite__reference__delete_delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"403":{"description":"The caller may not change this record","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organisations/invite/{invite_reference}/resend":{"patch":{"tags":["Invites"],"summary":"Send an invite again","description":"No body. Its sender, a platform `admin` or `super_admin`, or an `organisation_admin` of the organisation it is for (403 otherwise). Gives the invite another 7 days. One that has run out gave its seat up, so resending it needs a free seat on a live product (400 otherwise). An invite that was already accepted cannot be resent. 409 if it offers `organisation_admin` and the organisation now has one or another invitation is offering it.","operationId":"resend_invite_organisations_invite__invite_reference__resend_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"invite_reference","in":"path","required":true,"schema":{"type":"string","title":"Invite Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"403":{"description":"The caller may not change this record","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organisations/invite/{invite_reference}/accept":{"patch":{"tags":["Invites"],"summary":"Accept an invite","description":"No body. The invite must be addressed to the signed-in user, and takes a seat on each product it grants. 400 once its 7 days have run out.","operationId":"accept_invite_organisations_invite__invite_reference__accept_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"invite_reference","in":"path","required":true,"schema":{"type":"string","title":"Invite Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organisations/{reference}/licensed-users":{"get":{"tags":["Members"],"summary":"Who holds which product","description":"One row per person per product, with the seat summary per product in `products`. Unaccepted invites count in `seats.used` but are not rows; list them with `GET /organisations/invite?status=PENDING`.\n\nPaged: `page` (or `page=all` for everything) and `ordering=field` / `ordering=-field`. `all` searches every field. Any other query parameter is an exact filter, with `true`/`false` read as booleans.","operationId":"get_licensed_users_organisations__reference__licensed_users_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Page number, or `all` for no paging.","examples":["1"],"title":"Page"},"description":"Page number, or `all` for no paging."},{"name":"ordering","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`field` ascending, `-field` descending. Default `first_name`.","examples":["-last_name"],"title":"Ordering"},"description":"`field` ascending, `-field` descending. Default `first_name`."},{"name":"all","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search first name, last name and email.","title":"All"},"description":"Search first name, last name and email."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"organisation_reference":{"type":"string"},"organisation_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"type":"array","items":{"type":"object","properties":{"product_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"seats":{"type":"object","properties":{"total":{"type":"integer"},"used":{"type":"integer"},"available":{"type":"integer"}},"required":["total","used","available"],"additionalProperties":true},"awaiting_acceptance":{"type":"integer"}},"required":["seats","awaiting_acceptance"],"additionalProperties":true}},"items":{"type":"array","items":{"type":"object","properties":{"user_reference":{"type":"string"},"name":{"type":"string"},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"product_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["user_reference","name"],"additionalProperties":true}},"pagination":{"type":"object","properties":{"current_page":{"type":"integer"},"page_size":{"type":"integer"},"total_records":{"type":"integer"},"total_pages":{"type":"integer"},"has_next":{"type":"boolean"},"has_previous":{"type":"boolean"}},"required":["current_page","page_size","total_records","total_pages","has_next","has_previous"],"additionalProperties":true}},"required":["organisation_reference","products","items","pagination"],"additionalProperties":true},"example":{"organisation_reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine","products":[{"product_reference":"prod-polpred","product_name":"PolPred","status":"active","valid_to":"2027-01-01","seats":{"total":5,"used":2,"available":3},"awaiting_acceptance":1},{"product_reference":"prod-tidemorph","product_name":"TideMorph","status":"active","valid_to":"2026-11-01","seats":{"total":1,"used":0,"available":1},"awaiting_acceptance":0}],"items":[{"user_reference":"33333333-3333-3333-3333-333333333333","name":"Jane Doe","email":"jane@example.com","role":"user","product_reference":"prod-polpred","product_name":"PolPred","status":"active","valid_to":"2027-01-01"}],"pagination":{"current_page":1,"page_size":10,"total_records":1,"total_pages":1,"has_next":false,"has_previous":false}}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organisations/{reference}/user/{user_reference}/products/remove":{"patch":{"tags":["Members"],"summary":"Take products away from a member","description":"The organisation's own `organisation_admin`, a platform `admin` or `super_admin`, or whoever created the organisation. `products` is required and must name at least one product.","operationId":"remove_products_organisations__reference__user__user_reference__products_remove_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}},{"name":"user_reference","in":"path","required":true,"schema":{"type":"string","title":"User Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"type":"string"}}},"required":["products"],"additionalProperties":true},"example":{"products":["prod-tidemorph"]}}}}}},"/organisations/{reference}/users/products/remove":{"patch":{"tags":["Members"],"summary":"Take products away from many members","description":"Who may call it is the same as for one member. `products` and `user_references` are both required. All or nothing: 404 naming anybody unknown, 409 naming anybody not in this organisation, and then nobody is changed. Answers with the organisation's reference.","operationId":"remove_products_from_users_organisations__reference__users_products_remove_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"products":{"type":"array","items":{"type":"string"}},"user_references":{"type":"array","items":{"type":"string"}}},"required":["products","user_references"],"additionalProperties":true},"example":{"products":["prod-tidemorph"],"user_references":["33333333-3333-3333-3333-333333333333"]}}}}}},"/organisations/{reference}/user/{user_reference}/leave":{"post":{"tags":["Members"],"summary":"Leave, or remove a member from, an organisation","description":"The person themselves (leaving), an `organisation_admin` of this organisation, or a platform `admin` or `super_admin` (removing somebody). 403 for anybody else, and for the organisation's last `organisation_admin`. 404 if the person is not a member. The body is optional; `reason` is accepted but not stored yet.","operationId":"leave_organisation_organisations__reference__user__user_reference__leave_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}},{"name":"user_reference","in":"path","required":true,"schema":{"type":"string","title":"User Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"403":{"description":"The caller may not change this record","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","properties":{"reason":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":[],"additionalProperties":true},"example":{"reason":"Moving to another team"}}}}}},"/organisations":{"post":{"tags":["Organisations"],"summary":"Create an organisation","description":"`country` is a country name, e.g. `United Kingdom`. A customer organisation needs the `otp_reference` from signup.","operationId":"create_organisation_organisations_post","security":[{"HTTPBearer":[]}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"403":{"description":"The caller may not change this record","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"451":{"description":"Only a super admin may do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organisation_name":{"type":"string"},"phone":{"type":"string"},"country":{"type":"string","description":"A country name, e.g. `United Kingdom`."},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"otp_reference":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["organisation_name","phone","country"],"additionalProperties":true},"example":{"organisation_name":"Acme Marine","phone":"+447700900123","country":"United Kingdom","website":"https://example.com","email":"info@example.com","otp_reference":"66666666-6666-6666-6666-666666666666"}}}}},"get":{"tags":["Organisations"],"summary":"List organisations","description":"Super admins only. Text filters are partial and case-insensitive. Each product's `seats_used` is counted when read: people on it plus invites still holding a seat.\n\nPaged: `page` (or `page=all` for everything) and `ordering=field` / `ordering=-field`. `all` searches every field. Any other query parameter is an exact filter, with `true`/`false` read as booleans.","operationId":"get_all_organisations_organisations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Page number, or `all` for no paging.","examples":["1"],"title":"Page"},"description":"Page number, or `all` for no paging."},{"name":"ordering","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`field` ascending, `-field` descending. Default `-created_at_timestamp`.","examples":["organisation_name"],"title":"Ordering"},"description":"`field` ascending, `-field` descending. Default `-created_at_timestamp`."},{"name":"all","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search across every field, and the licence.","title":"All"},"description":"Search across every field, and the licence."},{"name":"organisation_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial, case-insensitive.","title":"Organisation Name"},"description":"Partial, case-insensitive."},{"name":"email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial, case-insensitive.","title":"Email"},"description":"Partial, case-insensitive."},{"name":"phone","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial, case-insensitive.","title":"Phone"},"description":"Partial, case-insensitive."},{"name":"platform_organisation","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"`true` for the platform organisation only.","title":"Platform Organisation"},"description":"`true` for the platform organisation only."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"reference":{"type":"string"},"organisation_name":{"type":"string"},"platform_organisation":{"type":"boolean"},"country":{"description":"As stored: a country name, or `{label, code}`."},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"license":{"type":"object","properties":{"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_class":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"active_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"expires_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"type":"array","items":{"type":"object","properties":{"product_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"users":{"type":"array","items":{"type":"string"}},"seats_used":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"required":[],"additionalProperties":true}}},"required":[],"additionalProperties":true},"created_by_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["reference","organisation_name","platform_organisation","license"],"additionalProperties":true}},"pagination":{"type":"object","properties":{"current_page":{"type":"integer"},"page_size":{"type":"integer"},"total_records":{"type":"integer"},"total_pages":{"type":"integer"},"has_next":{"type":"boolean"},"has_previous":{"type":"boolean"}},"required":["current_page","page_size","total_records","total_pages","has_next","has_previous"],"additionalProperties":true}},"required":["items","pagination"],"additionalProperties":true},"example":{"items":[{"reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine","platform_organisation":false,"country":{"label":"United Kingdom","code":"GB"},"website":"https://example.com","email":"info@example.com","phone":"+447700900123","role":"organisation_admin","license":{"reference":"55555555-5555-5555-5555-555555555555","email":"admin@example.com","code":"ABCD-EFGH-IJKL","license_type":"subscription","license_class":"professional","max_users":5,"active_users":0,"duration":12,"valid_from":"2026-01-01","valid_to":"2027-01-01","expires_at_timestamp":"2027-01-01T00:00:00","status":"active","products":[{"product_reference":"prod-polpred","product_name":"PolPred","license_type":"subscription","max_users":5,"valid_from":"2026-01-01","valid_to":"2027-01-01","status":"active","users":["33333333-3333-3333-3333-333333333333"],"seats_used":1},{"product_reference":"prod-tidemorph","product_name":"TideMorph","license_type":"trial","max_users":1,"valid_from":"2026-01-01","valid_to":"2026-11-01","status":"active","users":[],"seats_used":0}]},"created_by_reference":"44444444-4444-4444-4444-444444444444","created_at_timestamp":"2026-01-01T00:00:00"}],"pagination":{"current_page":1,"page_size":10,"total_records":1,"total_pages":1,"has_next":false,"has_previous":false}}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"451":{"description":"Only a super admin may do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/organisations/current":{"get":{"tags":["Organisations"],"summary":"The signed-in user's organisation","description":"Resolved from the token, with its licence and per-product seats. Each product's `seats_used` is counted when read: people on it plus invites still holding a seat.","operationId":"get_current_organisation_organisations_current_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"reference":{"type":"string"},"organisation_name":{"type":"string"},"platform_organisation":{"type":"boolean"},"country":{"description":"As stored: a country name, or `{label, code}`."},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"license":{"properties":{"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_class":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"active_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"expires_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"items":{"properties":{"product_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"users":{"items":{"type":"string"},"type":"array"},"seats_used":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":[]},"type":"array"}},"additionalProperties":true,"type":"object","required":[]},"created_by_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]}},"additionalProperties":true,"type":"object","required":["reference","organisation_name","platform_organisation","license"]},"example":{"reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine","platform_organisation":false,"country":{"label":"United Kingdom","code":"GB"},"website":"https://example.com","email":"info@example.com","phone":"+447700900123","role":"organisation_admin","license":{"reference":"55555555-5555-5555-5555-555555555555","email":"admin@example.com","code":"ABCD-EFGH-IJKL","license_type":"subscription","license_class":"professional","max_users":5,"active_users":0,"duration":12,"valid_from":"2026-01-01","valid_to":"2027-01-01","expires_at_timestamp":"2027-01-01T00:00:00","status":"active","products":[{"product_reference":"prod-polpred","product_name":"PolPred","license_type":"subscription","max_users":5,"valid_from":"2026-01-01","valid_to":"2027-01-01","status":"active","users":["33333333-3333-3333-3333-333333333333"],"seats_used":1},{"product_reference":"prod-tidemorph","product_name":"TideMorph","license_type":"trial","max_users":1,"valid_from":"2026-01-01","valid_to":"2026-11-01","status":"active","users":[],"seats_used":0}]},"created_by_reference":"44444444-4444-4444-4444-444444444444","created_at_timestamp":"2026-01-01T00:00:00"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object"},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"additionalProperties":true,"type":"object","required":["error_reference","error_type","errors","status_code","timestamp"]},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}}},"security":[{"HTTPBearer":[]}]}},"/organisations/{reference}":{"get":{"tags":["Organisations"],"summary":"Read one organisation","description":"Administrators may read any organisation, everybody else only their own. Anybody else gets 404, the same as a reference that does not exist. Each product's `seats_used` is counted when read: people on it plus invites still holding a seat.","operationId":"get_organisation_by_reference_organisations__reference__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"},"organisation_name":{"type":"string"},"platform_organisation":{"type":"boolean"},"country":{"description":"As stored: a country name, or `{label, code}`."},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"role":{"anyOf":[{"type":"string"},{"type":"null"}]},"license":{"type":"object","properties":{"reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"code":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_class":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"active_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"duration":{"anyOf":[{"type":"integer"},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"expires_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"products":{"type":"array","items":{"type":"object","properties":{"product_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"product_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"license_type":{"anyOf":[{"type":"string"},{"type":"null"}]},"max_users":{"anyOf":[{"type":"integer"},{"type":"null"}]},"valid_from":{"anyOf":[{"type":"string"},{"type":"null"}]},"valid_to":{"anyOf":[{"type":"string"},{"type":"null"}]},"status":{"anyOf":[{"type":"string"},{"type":"null"}]},"users":{"type":"array","items":{"type":"string"}},"seats_used":{"anyOf":[{"type":"integer"},{"type":"null"}]}},"required":[],"additionalProperties":true}}},"required":[],"additionalProperties":true},"created_by_reference":{"anyOf":[{"type":"string"},{"type":"null"}]},"created_at_timestamp":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["reference","organisation_name","platform_organisation","license"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111","organisation_name":"Acme Marine","platform_organisation":false,"country":{"label":"United Kingdom","code":"GB"},"website":"https://example.com","email":"info@example.com","phone":"+447700900123","role":"organisation_admin","license":{"reference":"55555555-5555-5555-5555-555555555555","email":"admin@example.com","code":"ABCD-EFGH-IJKL","license_type":"subscription","license_class":"professional","max_users":5,"active_users":0,"duration":12,"valid_from":"2026-01-01","valid_to":"2027-01-01","expires_at_timestamp":"2027-01-01T00:00:00","status":"active","products":[{"product_reference":"prod-polpred","product_name":"PolPred","license_type":"subscription","max_users":5,"valid_from":"2026-01-01","valid_to":"2027-01-01","status":"active","users":["33333333-3333-3333-3333-333333333333"],"seats_used":1},{"product_reference":"prod-tidemorph","product_name":"TideMorph","license_type":"trial","max_users":1,"valid_from":"2026-01-01","valid_to":"2026-11-01","status":"active","users":[],"seats_used":0}]},"created_by_reference":"44444444-4444-4444-4444-444444444444","created_at_timestamp":"2026-01-01T00:00:00"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Organisations"],"summary":"Update an organisation","description":"The owner or a super admin. Send only the fields that change.","operationId":"update_organisation_organisations__reference__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"400":{"description":"The body is missing, not JSON, or has a field that is not usable","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"409":{"description":"It already exists, or the change clashes with the current state","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organisation_name":{"anyOf":[{"type":"string"},{"type":"null"}]},"website":{"anyOf":[{"type":"string"},{"type":"null"}]},"email":{"anyOf":[{"type":"string"},{"type":"null"}]},"phone":{"anyOf":[{"type":"string"},{"type":"null"}]},"country":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":[],"additionalProperties":true},"example":{"organisation_name":"Acme Marine Ltd","phone":"+447700900124"}}}}},"delete":{"tags":["Organisations"],"summary":"Delete an organisation","description":"Administrators only. Also withdraws its outstanding invites. The platform organisation cannot be deleted.","operationId":"delete_organisations_organisations__reference__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"reference","in":"path","required":true,"schema":{"type":"string","title":"Reference"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":true},"example":{"reference":"11111111-1111-1111-1111-111111111111"}}}},"401":{"description":"No token, an expired token, or a caller not allowed to do this","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"403":{"description":"The caller may not change this record","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"404":{"description":"No such record, or one this caller may not see (the same answer, deliberately)","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"500":{"description":"Unexpected failure. Quote `error_reference` when reporting it","content":{"application/json":{"schema":{"type":"object","properties":{"error_reference":{"type":"string"},"error_type":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"status_code":{"type":"integer"},"timestamp":{"type":"string"}},"required":["error_reference","error_type","errors","status_code","timestamp"],"additionalProperties":true},"example":{"error_reference":"c204cb51-7b46-4d70-9385-5697815e402e","error_type":"NOT_FOUND_ERROR","errors":{"message":["A organisation record with the reference 11111111-1111-1111-1111-111111111111 does not exist."]},"status_code":404,"timestamp":"2026-09-30T11:17:16.151897"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"HTTPBearer":{"type":"http","description":"The access token from sign-in.","scheme":"bearer"}}}}