diff --git a/openapi.yaml b/openapi.yaml index 026e61a..90b5053 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -29,7 +29,7 @@ info: Authorization: Bearer mk_live_... ``` - A key belongs to one Organisation and acts as the colleague chosen when it was created: it can see and do only what they can, in that Organisation only. It can call the same endpoints as a connected app (OAuth), and gets `403` with `not_available_to_connected_apps` from any other. If the colleague leaves the Organisation, or the key is revoked, requests get `401`. Calls made with an Organisation's API keys count towards its monthly API usage. + A key belongs to one Organisation and acts as the colleague chosen when it was created: it can see and do only what they can, in that Organisation only. It can call the same endpoints as a connected app (OAuth), and gets `403` with `not_available_to_connected_apps` from any other, even when the same request works with a person's own token. The endpoints it can call are listed in the API keys section of https://api-docs.makerble.com/#api-keys. If the colleague leaves the Organisation, or the key is revoked, requests get `401`. Calls made with an Organisation's API keys count towards its monthly API usage. ## Creating Users via the API `POST /users` requires a separate API Key (`auth_code`). Request one at [api-key-request@makerble.com](mailto:api-key-request@makerble.com). @@ -6069,6 +6069,8 @@ paths: summary: Get Stories with full survey response detail description: | Returns Stories enriched with named Indicators, Changes, and Custom Fields — ideal for reporting and data exports. + + Not yet available with an Organisation API key or a connected app (OAuth): they get `403` with `not_available_to_connected_apps`. Call it with a person's `X-User-Email` and `X-User-Token`. With an API key, read the same answers from `GET /stories` (each Story's `story_indicator_beneficiaries`, `story_change_beneficiaries` and `custom_fields`, filtered on `story_category_id` and `project_id`), and look up question names with `GET /indicators` and `GET /scale_indicator_choices`. operationId: listStoryCategoryResponses security: [{tokenAuth: []}] parameters: @@ -6105,6 +6107,17 @@ paths: $ref: '#/components/schemas/PaginatedStoryCategoryResponses' "401": $ref: '#/components/responses/Unauthorized' + "403": + description: Called with an Organisation API key or a connected app, which can't use this endpoint yet + content: + application/json: + schema: + type: object + properties: + error: + type: string + example: + error: not_available_to_connected_apps /story_categories: get: diff --git a/server.js b/server.js index a479da4..fce1338 100644 --- a/server.js +++ b/server.js @@ -2238,7 +2238,10 @@ function buildDocsPage() { { name: "project_ids[]", type: "integer", required: false, desc: "Filter by Project ID (repeat for multiple)" }, { name: "start_date", type: "string", required: false, desc: "YYYY-MM-DD — stories on or after this date" }, { name: "end_date", type: "string", required: false, desc: "YYYY-MM-DD — stories on or before this date" } - ], [{ code: "200", cls: "response-2xx", desc: "Stories enriched with named Indicators, Changes, and Custom Field values — ideal for reporting" }])} + ], [ + { code: "200", cls: "response-2xx", desc: "Stories enriched with named Indicators, Changes, and Custom Field values — ideal for reporting" }, + { code: "403", cls: "response-4xx", desc: "not_available_to_connected_apps: called with an Organisation API key or a connected app" } + ], `Not yet available with an Organisation API key or a connected app: they get 403 with not_available_to_connected_apps. Call it with a person's X-User-Email and X-User-Token, or, with an API key, read the same answers from GET /stories (each Story's story_indicator_beneficiaries, story_change_beneficiaries and custom_fields, filtered on story_category_id and project_id) and look up question names with GET /indicators and GET /scale_indicator_choices.`)} ${endpointCard("GET", "/stories/{id}/attachments", "Get attachments for a Story", true, [ { name: "id", in: "path", type: "integer", required: true, desc: "Story ID" } ], [{ code: "200", cls: "response-2xx", desc: "Paginated media attachments" }])} @@ -4269,6 +4272,86 @@ function buildDocsPage() {

An API key lets a custom integration call the API for one Organisation without using a person's own token. An Organisation Admin creates one in Makerble under Data In & Out → Integrations → API keys, or with POST /api_keys below. The key itself (mk_live_…) is shown only once, when it is created.

Using a key: send Authorization: Bearer mk_live_… on every request. The key acts as the colleague chosen when it was created: it can see and do only what they can, in its Organisation only. It can call the same endpoints as a connected app (OAuth); any other answers 403 with not_available_to_connected_apps. A revoked key, or one whose colleague has left the Organisation, gets 401. Calls made with an Organisation's API keys count towards its monthly API usage.

+

Which endpoints a key can call: an Organisation API key is limited to one Organisation, so it can only call endpoints that have been checked to return that Organisation's data and nothing else. Those are listed below. Any other endpoint answers 403 with not_available_to_connected_apps, even when the same request works with a person's X-User-Email and X-User-Token. A person's own token can call every endpoint, and sees everything that person can see in every Organisation they belong to. More endpoints are added to this list as they are checked; if you need one that isn't here, contact Makerble support.

+
+ Endpoints an Organisation API key or connected app can call (74) + +

Managing keys: only the Organisation's admins can list, create and revoke its keys, and only with their own X-User-Email and X-User-Token: an API key, an AI assistant link or a connected app can't create or revoke keys.