{"openapi":"3.1.0","info":{"title":"Magistry API","version":"1.0.0","description":"Programmatic access to a Magistry store, backed by the same tool registry as the in-dashboard AI operator (Magistry) and the MCP server. Authenticate with an OAuth 2.1 access token or a Magistry API key."},"servers":[{"url":"https://app.magistry.io"}],"x-client-contract":[{"id":"retry-503","since":"2026-10-27","applies":"all","rule":"A 503 from any Magistry endpoint (/api/oauth/token, /api/mcp, /api/v1) means something on our side failed and your credential is still valid. Wait for the Retry-After header and send the same request again. Never discard a token or restart authorization because of a 503."},{"id":"reconnect-401","since":"2026-10-27","applies":"all","rule":"A 401 carrying WWW-Authenticate: Bearer resource_metadata=\"…\" means this access token is no longer accepted. Refresh it once; if the refresh answers invalid_grant, start authorization again from the resource metadata URL in that header. Do not retry a 401 unchanged."},{"id":"refresh-grace","since":"2026-10-27","applies":"token","rule":"A refresh token is single-use, with one exception: presenting the token one generation back within 12 hours (43200 seconds) of its rotation, while the token it was rotated to has never been used, returns a fresh token pair instead of invalid_grant. Once the newer token has been presented, the older one is refused for good."},{"id":"persist-rotation","since":"2026-10-27","applies":"token","rule":"Every successful refresh returns a new refresh_token and retires the one you sent. Write the new refresh token to durable storage before you use the new access token, and let every process that refreshes the same connection read and write that one store."},{"id":"unattended-key","since":"2026-10-27","applies":"all","rule":"An agent that runs with no person at a browser (a scheduled job, a server, a background worker) authenticates with a Magistry API key (mag_sk_live_…), not OAuth. An API key is bound to one store: create one key per store."},{"id":"token-429","since":"2026-10-27","applies":"token","rule":"/api/oauth/token accepts 1200 requests per source address per hour. Above that it answers 429 with error temporarily_unavailable and Retry-After: 60; wait that long and retry. A 429 says nothing about your credential: keep the refresh token."},{"id":"tools-pagination","since":"2026-10-27","applies":"mcp","rule":"On protocol revision 2026-07-28, tools/list returns at most 100 tools per response. When a result carries nextCursor, call tools/list again with that cursor until a result has none: a client that stops at the first page holds an incomplete catalogue and gets no error saying so. The cursor is opaque; an altered one is refused with -32602. Earlier revisions receive the whole catalogue in one response."}],"tags":[{"name":"billing","description":"Operations whose scope is `billing:read` or `billing:write`. 6 operations."}],"x-other-endpoints":[{"path":"/api/v1/openapi.json","methods":["GET"],"auth":"none","about":"This document."},{"path":"/api/v1/operations.json","methods":["GET"],"auth":"none","about":"Every operation of this document in one line each: name, method, path, scope, risk, area and summary."},{"path":"/api/v1/asyncapi.json","methods":["GET"],"auth":"none","about":"The outbound event contract for webhook subscriptions."},{"path":"/api/v1/changelog.json","methods":["GET"],"auth":"none","about":"Support policy and every announced deprecation."},{"path":"/api/v1/preflight","methods":["POST"],"auth":"none","about":"Judges an intended action against the published guardrails and executes nothing; reads no store."},{"path":"/api/v1/sandbox","methods":["POST"],"auth":"session","about":"Mints a sandbox API key from a signed-in dashboard session (the developer page)."},{"path":"/api/v1/tools","methods":["GET"],"auth":"bearer","about":"The tools this credential reaches, with their input schemas: the same exposure as MCP tools/list."},{"path":"/api/v1/audit","methods":["GET"],"auth":"bearer","about":"What credentials did to the stores this credential covers (`developer:read`); reading it is itself audited."},{"path":"/api/v1/subscriptions","methods":["GET","POST"],"auth":"bearer","about":"Store webhook subscriptions (`automation:write`, plus the read scope of every event type filtered); events in the AsyncAPI document."},{"path":"/api/v1/partner-tools","methods":["GET","POST"],"auth":"bearer","about":"A partner MCP server wired in as a read-only data source for the agents (`automation:write` or `developer:write`)."},{"path":"/api/v1/finance/subscriptions","methods":["GET","POST","DELETE"],"auth":"bearer","about":"A finance entity's webhook subscriptions (`finance:read` and the entity in the app's grant)."},{"path":"/api/v1/finance/odata/{entity_id}","methods":["GET"],"auth":"basic","about":"The finance BI views as an OData v4 feed for Excel and Power BI; the API key is the Basic password, `finance:read`."}],"components":{"responses":{"Error400":{"description":"`invalid_request` — The request is malformed or an argument is unusable. The message names which.\n\n`invalid_body` — The body is not a JSON object.\n\n`invalid_arguments` — The arguments do not match the tool's input schema. `details.issues` lists each one: the argument path, what was expected and what came. Nothing ran.\n\n`invalid_json` — The body does not parse as JSON. The message quotes the parser and names the shape that was expected.\n\n`idempotency_required` — This write tool has no keyless mode: it was added after 2026-10-27, when keys became required for new write tools, so a retry after a timeout can never be a second write. Nothing ran.\n\n`invalid_expiry` — An approval request must end: `expires_at` lies at least 5 minutes and at most 7 days after it is filed. A request with no decision by then closes as expired, which means not approved.\n\n`invalid_rule` — The rule could not bind as written: a fact or action outside the vocabulary, an operator that cannot compare that fact, or a limit with no bound. Nothing was saved.\n\n`unsupported_behavior` — The request pinned a `Magistry-Behavior` version the finance API does not serve. A pin that is not honoured is refused rather than silently served as the current behaviour.\n\n`person_only_field` — The request tried to change a field only a person may change: the bank account customers pay into (`iban`, `bic`, `account_name`). `fields` names which. Nothing was written, including the other fields in the same request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error401":{"description":"`unauthorized` — No credential was presented, or the one presented is not valid. This deliberately does not say whether it was unknown or forged: a 401 that tells those apart is an oracle for guessing tokens. A credential that VERIFIED and is refused answers with its own code (expired, grant_revoked, app_disabled, address_not_allowed, store_not_installed).\n\n`expired` — The credential verified and its expiry has passed.\n\n`grant_revoked` — The OAuth token verified, and the merchant revoked this connection after it was issued.\n\n`store_not_installed` — The credential verified, and every store it names has uninstalled Magistry or had its data redacted. A credential that also names installed stores keeps those and only loses the gone one.\n\n`app_disabled` — The OAuth token verified, and Magistry has disabled this application for every merchant. No token of the application is admitted and none is issued.\n\n`address_not_allowed` — The credential verified and carries an IP allowlist that this request did not come from.\n\n`credential_rejected` — Diagnose could not resolve the credential at all.\n\n`no_credential` — Diagnose was called with no Authorization header, so there is nothing to report on.\n\n`invalid_client` — The client authentication on this request did not verify.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error403":{"description":"`forbidden` — The credential is valid and does not hold a scope this tool requires.\n\n`insufficient_scope` — As `forbidden`, and the body names `required_scopes`. A webhook subscription needs both `automation:write` to configure the store and the read scope for every type it filters — a webhook is a read.\n\n`entity_not_granted` — The credential holds a finance scope, and the entity's owner has not given this app those books (or has taken them back). A finance scope says what an app may do; the owner's grant says which entities. A natural person's books need the person's own explicit delegate grant.\n\n`app_not_reviewed` — Magistry has not reviewed this app for finance (F11-03). An unreviewed app reads sandbox books only, at 5% of the finance rate buckets, and writes nothing — not even a proposal. The owner's grant is kept.\n\n`feature_off` — The finance capability this operation uses (statement push, till day closes, batch proposals, the purchase register, an export format, a bookkeeping read) is switched off platform-wide, so nothing was read or written. `reason` or `feature` names which. Nothing about the books, the request or the credential is wrong.\n\n`person_step_required` — The step asked for is a person's and no app may take it: the consent at a bank (PSD2 strong customer authentication) or at Moneybird or Exact Online (OAuth sign-in), or ending a books connection, which only a new consent undoes. `url` is the Magistry page where the person does it, `poll` the request that shows when it is done. Nothing was started, ended or written.\n\n`provider_not_configured` — Magistry has not set up its application at this provider (Enable Banking, Moneybird or Exact Online) on this deployment, so the connection cannot be made by anyone yet. Nothing was started or written.\n\n`person_only_action` — The request asked for an act only a person may do: sending an invoice, an e-invoice or a payment reminder, or retrying a send. A send leaves Magistry and cannot be undone. `action` names which. Nothing was read, written or sent.\n\n`finance_feature_off` — The finance feature this operation belongs to is not switched on for the platform yet, so nothing was read. `feature` names it (`bi_feed` for the BI views, the XLSX values export and the OData feed). Nothing about the books or the credential is wrong.\n\n`human_only` — Only a person may make this change, in Magistry: loosening workspace security (`reason: security_weakening` — two-factor or SSO off, a longer or no session limit, an IP range removed or added to a list that already restricts, an email domain allowed), or leaving a workspace. `route` names the page. Nothing was changed or proposed, including the other fields of the same request.\n\n`workspace_role_required` — The person this credential acts for does not hold the workspace role the same change or view needs in the dashboard (owner or admin for the team and security, `viewAudit` for the security log). Nothing was read or proposed.\n\n`agency_suspended` — Magistry has suspended this manager account, so it reaches none of its clients. Billing stays readable. Nothing was read or proposed.\n\n`role_cannot_hold_credentials` — An app may give Magistry a mailbox password only on behalf of an owner or admin of the store; the person who granted this connection is neither. Nothing was saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error404":{"description":"`not_found` — No tool of that name is exposed to this credential. Note that a tool hidden by a missing scope answers `forbidden`, not this — the two are told apart deliberately.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error409":{"description":"`limit_reached` — The store already holds the most of this resource it may have (live webhook subscriptions, partner tool sources); the message states the cap. Nothing was created.\n\n`idempotency_conflict` — This idempotency key was already used with DIFFERENT arguments. Replaying it would be a second, different write under a key that promises one.\n\n`idempotency_in_flight` — A request with this key is still running. This is not an error — it is \"ask again\", and the response carries `Retry-After`.\n\n`idempotency_outcome_unknown` — A request with this key was claimed and never finished — the run died before its answer was recorded — and its replay window has passed. Whether it took effect is not known, so it is not run again, and waiting does not change this answer (there is no `Retry-After`).\n\n`idempotency_secret_not_replayed` — The first request with this key succeeded and answered a secret once (a new inbound-mail address token). Secrets are never stored, so a retry cannot repeat that answer, and it is not run again either.\n\n`secret_already_issued` — The first request with this idempotency key succeeded and answered a secret (an API key or token), which is shown once and never kept. A retry with the same key is not answered with it and runs nothing; the answer names the credential (`id`, `prefix`) so you can find it.\n\n`rotation_not_found` — No key with that id exists on this store, so nothing was rotated.\n\n`rotation_invalid_input` — The rotation was asked without a key, a new prefix and hash, or with an overlap outside 0 to 90 days. Nothing was rotated.\n\n`rotation_revoked` — The key is already revoked, and a revoked key is never rotated. Nothing was rotated.\n\n`rotation_already_rotated` — The key was already rotated; it has a successor and is in its overlap. Rotating it again would leave two successors.\n\n`rotation_blocked:fin_app_entity_grants` — The key holds a finance entity grant, which only its granter can give a new key, so it cannot be carried to a successor. Nothing was rotated.\n\n`rotation_blocked:fin_event_subscriptions` — The key holds a live finance event subscription, which only its granter can give a new key, so it cannot be carried to a successor. Nothing was rotated.\n\n`rotation_blocked:fin_firm_credentials` — The key holds a firm credential, which only its granter can give a new key, so it cannot be carried to a successor. Nothing was rotated.\n\n`rotation_blocked:app_review` — The successor would need an app review the key does not carry. Nothing was rotated. `details.reason` names the scope.\n\n`rotation_failed` — The rotation did not complete for a reason that is ours. It runs as one transaction: either all of it happened or none of it did.\n\n`no_policy` — The app has no grant for this field on this store. Owning a field is a separate, larger grant than a scope: the reconciler pushes what the owner declares, and nobody else may touch the field meanwhile.\n\n`held_by_other` — Another owner holds this field, named in `held_by`. A field has at most one owner, enforced by a unique index, and an app never takes a field over from a live holder.\n\n`raced` — Another owner took this field in the same instant as this declaration. The database let exactly one of the two through.\n\n`merchant_kept` — The merchant kept an outside change to this field. Once kept, the database refuses every new declaration on it unless a store rule allows declaring it again.\n\n`too_many_pending` — This app already has the maximum number of approval requests pending on this store (the body carries `pending` and `limit`). The bound keeps one app from burying the merchant's screen.\n\n`already_closed` — The approval request was decided, expired or withdrawn before this call; `status` says which. A closed request never reopens.\n\n`store_unavailable` — The store is not accepting approval requests because Magistry is not installed on it.\n\n`too_many_rules` — The store already holds the maximum number of rules.\n\n`in_flight` — The declaration is being written to the platform at this moment, so it cannot be reverted underneath that write.\n\n`revert_via_theme_rollback` — The declaration is an app's theme file change (theme_file.file_patch). It is undone by rolling back its deploy, never by reverting or releasing the declaration; nothing was changed.\n\n`overwritten_externally` — Someone other than this app changed the field on the platform after the app's value was applied, and the merchant has not yet decided whether that change stays. A revert now would overwrite it, so nothing was reverted.\n\n`statement_conflict` — The bank statement does not continue what the books already hold for this account: its opening balance differs from the last booked closing balance, it overlaps a period already pushed, or its duplicate lines do not balance. `reason` and `detail` name which, with the checkpoint it was tested against. Nothing was imported.\n\n`close_conflict` — The books cannot take this till day close: the day is already counted, the till settles through Shopify POS, the day lies before the store's settle-from date, the settlement channel is off, or the period is closed, filed or missing. `reason` names which. Nothing was booked.\n\n`invalid_state` — The record is not in a state this write can move it from (a note already resolved, a client request not yet answered), so nothing was written. `reason` is the database's own key and names the state.\n\n`sales_conflict` — The books cannot take this sales write in their current state: the period it books into is closed or filed (`fin.period_closed`), the invoice is no longer a draft, or an allocation exceeds what is open. `reason` is the SQL's own. Nothing was written.\n\n`finance_period_closed` — The write would land in a closed period of the books, so nothing was written. `reason` is `fin.period_closed`. An app links and unlinks documents only in open periods (finance_documents_write); a person may still attach evidence there in Books.\n\n`finance_proposal_refused` — The books refused the proposal in their current state: the entity's owner has not switched app proposals on (Books → Assistant), or the period it would land in is closed. Nothing was recorded and nothing was posted. `reason` names which.\n\n`period_closed` — The write would change a period that is closed (or filed): its entries keep what they say, and nothing is proposed into it. Nothing was written. `reason` is the books' own code (`fin.period_closed`, `fin.period_filed`, `fin.no_period` — a date with no opened period — or `fin.proposal_period_closed`).\n\n`time_import_not_connected` — Magistry holds no credential for the hours provider named in `source`, so nothing was read from it and nothing was written. A caller never sends the provider credential; Magistry holds it.\n\n`export_not_ready` — The export job has not produced its file (yet): `status` in the body says whether it is still `queued`/`running` or `failed`, with the failure's own code.\n\n`data_source_not_ours` — Merchant Center serves this market from another app's data source, not from Magistry, so nothing was pushed or switched on. `details` names that source (data_source_id, display_name, feed_label, country) and when it was read. No job was started.\n\n`data_source_missing` — The Merchant Center data source this market writes into no longer exists or is no longer a primary source, so nothing was pushed. No job was started.\n\n`no_workspace` — The store belongs to no workspace, so it has no workspace members, invitations, roles, security or security log. Its own members are read with member_list and changed with store_role_set / store_role_remove.\n\n`not_agency` — The store's workspace is a standard workspace, not a manager account, so it has no client book, credit pool or agency labels. Nothing was read or proposed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error410":{"description":"`finance_cursor_gone` — The change-feed cursor is older than the feed keeps (guarantees.finance_change_feed_retention_days in /api/v1/changelog.json) and events after it have been removed. The body carries `oldest_cursor`.\n\n`export_expired` — The export's file was downloadable until `expires_at` and is no longer kept.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error413":{"description":"`payload_too_large` — The body exceeds the endpoint’s size bound.\n\n`upload_too_large` — The file is larger than its purpose allows (25 MB for images, audio and attachments, 200 MB for video). A URL fetch stops at the first byte past the cap and keeps nothing; a stored file over it is deleted. Nothing was created.\n\n`export_too_large` — The view holds more rows than one workbook export carries, so no file was produced — never a file cut short. The body carries `cap`, `view` and, when known, `row_count`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error415":{"description":"`upload_type_refused` — The bytes are not a type the purpose accepts. The type is read from the file itself, never from the declared mime or the file name, and a file whose first bytes carry markup (a PNG header followed by a script) is no type at all. The stored copy was deleted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error422":{"description":"`tool_refused` — The tool ran its own checks and refused, or the write it attempted failed. `details` is the tool's own answer, word for word: its `error` says what was wrong and its `retryable`, when present, whether the identical call can succeed later.\n\n`upload_url_refused` — The URL could not be fetched as given: not https on port 443, a name that resolves to a private or reserved address, credentials in the URL, a redirect to any of those, a status other than 200, or a server slower than the purpose allows. The operation's error names which (`scheme_refused`, `address_refused`, `fetch_too_slow`, …).\n\n`not_supported` — The books do not support what was asked for this entity: the VAT preview and the other tax views are prepared for Dutch entities only, and a year whose rules are not in the tax pack yet cannot be prepared. Nothing was prepared.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error429":{"description":"`rate_limited` — This credential exceeded its per-minute limit. The body carries the limit and the count, and the response carries `Retry-After` and the `RateLimit-*` headers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error500":{"description":"`simulation_unverified` — The simulation could not prove that its transaction was aborted, so no verdict is given: an answer from a run that may have kept something would read as a clean one. Reported on our side.\n\n`server_error` — Something on our side failed. The request may or may not have taken effect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error502":{"description":"`sandbox_failed` — Creating or seeding the sandbox failed. Provisioning is one transaction, so nothing was created and the key shown to nobody was never stored.\n\n`time_import_provider_refused` — The hours provider named in `source` refused or failed the read, so nothing was written. A re-import adds nothing twice, so a retry is safe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Error503":{"description":"`verification_unavailable` — The credential verified, and a live check on it (revocation, the granted stores, an address restriction) could not be read because of a temporary problem on Magistry's side. It says nothing about the credential, which is still valid.\n\n`idempotency_unavailable` — The idempotency claim could not be taken, so the write was NOT attempted. This fails closed on purpose: running an unguarded write because the guard was unreadable is how a customer gets refunded twice.\n\n`approvals_unavailable` — Approval requests are not enabled on this server yet. Nothing was written.\n\n`receipts_unavailable` — Receipts are not enabled on this server yet. Nothing was exported.\n\n`policies_unavailable` — Store rules are not enabled on this server yet. Nothing was read or written.\n\n`sandbox_unavailable` — Developer sandboxes are not open: the database fence that keeps a sandbox key on demo data is not in place, or the provisioning worker is not configured. Nothing was created.\n\n`unavailable` — A read could not be served just now. Nothing was written or exported.\n\n`overwrites_unreadable` — We could not confirm that nobody else has changed this field since it was applied, and a revert that cannot check could overwrite a merchant's change. Nothing was reverted.\n\n`rls_scoped_execution_unavailable` — This deployment is not currently running the row-level-scoped execution mode the headless surface requires, so it refuses rather than executing with wider reach than the grant.\n\n`finance_grants_unavailable` — The entities this app may read could not be established for this request, so nothing was read — an unreadable grant is never treated as a wider one, nor as \"no entities\".\n\n`finance_unavailable` — The books could not be read or a figure could not be computed from them just now, so nothing was returned — never a partial list or a zero that would read as the ledger.\n\n`provider_unreachable` — The bank, payment or bookkeeping provider behind a books connection did not answer just now, so nothing was stored or started. `reason` is the provider check's own key. Nothing about the request or the secret is wrong.\n\n`export_unavailable` — The export job could not be started, read or served just now — including a stored file whose bytes do not match the SHA-256 the job recorded, which is never sent. Nothing was started or sent.\n\n`ownership_unreadable` — Merchant Center's data sources could not be read completely, so who owns this market is unknown and nothing was pushed or switched on. An unread owner is never treated as permission. No job was started.\n\n`corpus_unavailable` — The corpus this endpoint reads could not be loaded.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","description":"Every error the API answers with. `error` is a stable machine-readable code — branch on it, never on the prose. `request_id` identifies this one request and resolves to the audit row it wrote; quote it in support.","properties":{"error":{"type":"string","enum":["address_not_allowed","agency_suspended","already_closed","app_disabled","app_not_reviewed","approvals_unavailable","close_conflict","corpus_unavailable","credential_rejected","data_source_missing","data_source_not_ours","entity_not_granted","expired","export_expired","export_not_ready","export_too_large","export_unavailable","feature_off","finance_cursor_gone","finance_feature_off","finance_grants_unavailable","finance_period_closed","finance_proposal_refused","finance_unavailable","forbidden","grant_revoked","held_by_other","human_only","idempotency_conflict","idempotency_in_flight","idempotency_outcome_unknown","idempotency_required","idempotency_secret_not_replayed","idempotency_unavailable","in_flight","insufficient_scope","invalid_arguments","invalid_body","invalid_client","invalid_expiry","invalid_json","invalid_request","invalid_rule","invalid_state","limit_reached","merchant_kept","no_credential","no_policy","no_workspace","not_agency","not_found","not_supported","overwrites_unreadable","overwritten_externally","ownership_unreadable","payload_too_large","period_closed","person_only_action","person_only_field","person_step_required","policies_unavailable","provider_not_configured","provider_unreachable","raced","rate_limited","receipts_unavailable","revert_via_theme_rollback","rls_scoped_execution_unavailable","role_cannot_hold_credentials","rotation_already_rotated","rotation_blocked:app_review","rotation_blocked:fin_app_entity_grants","rotation_blocked:fin_event_subscriptions","rotation_blocked:fin_firm_credentials","rotation_failed","rotation_invalid_input","rotation_not_found","rotation_revoked","sales_conflict","sandbox_failed","sandbox_unavailable","secret_already_issued","server_error","simulation_unverified","statement_conflict","store_not_installed","store_unavailable","time_import_not_connected","time_import_provider_refused","too_many_pending","too_many_rules","tool_refused","unauthorized","unavailable","unsupported_behavior","upload_too_large","upload_type_refused","upload_url_refused","verification_unavailable","workspace_role_required"],"description":"The stable code. Removing or renaming one is a breaking change."},"message":{"type":"string","description":"For a person. Not part of the contract."},"request_id":{"type":"string"},"docs":{"type":"string","format":"uri"}},"required":["error","message","request_id"]}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Magistry API key (mag_sk_live_…) or OAuth access token"},"oauth2":{"type":"oauth2","flows":{"authorizationCode":{"authorizationUrl":"https://app.magistry.io/api/oauth/authorize","tokenUrl":"https://app.magistry.io/api/oauth/token","scopes":{"read":"Read all your store data. Does not include finance or social.","write":"Make changes across every store area (subject to your approval settings). Does not include finance or social.","catalog:read":"Read products, variants, content and pricing state.","catalog:write":"Read and change products, variants, content and pricing state.","ads:read":"Read Google Ads campaigns, budgets, keywords and creatives.","ads:write":"Read and change Google Ads campaigns, budgets, keywords and creatives.","analytics:read":"Read performance, reporting and comparisons.","analytics:write":"Read and change performance, reporting and comparisons.","merchant:read":"Read Merchant Center feeds, product statuses and issues.","merchant:write":"Read and change Merchant Center feeds, product statuses and issues.","orders:read":"Read orders, fulfilments, refunds and edits.","orders:write":"Read and change orders, fulfilments, refunds and edits.","cs:read":"Read customer-service threads and replies.","cs:write":"Read and change customer-service threads and replies.","promotions:read":"Read discounts and promotions.","promotions:write":"Read and change discounts and promotions.","costs:read":"Read product costs and operating expenses.","costs:write":"Read and change product costs and operating expenses.","automation:read":"Read agents, alerts, skills and job triggers.","automation:write":"Read and change agents, alerts, skills and job triggers.","research:read":"Read market/domain research and web lookups.","research:write":"Read and change market/domain research and web lookups.","reputation:read":"Read reviews and mentions.","reputation:write":"Read and change reviews and mentions.","disputes:read":"Read chargeback disputes.","disputes:write":"Read and change chargeback disputes.","creative:read":"Read studio designs, their exported files and the social posts proposed from them.","creative:write":"Read and change studio designs, their exported files and the social posts proposed from them.","finance:read":"Read the books (ledgers, postings, bank transactions and reports) of the finance entities you give this app in Books → Settings → Apps.","finance:write":"Read the books (ledgers, postings, bank transactions and reports) of the finance entities you give this app in Books → Settings → Apps and propose bookings for your approval. This app cannot post, approve, close, file or delete.","theme:read":"Read your store's theme files and change history.","theme:write":"Edit your theme and publish changes to your live store, within the approvals you set.","social:read":"Read your connected social accounts, posts and schedules.","social:write":"Publish posts to your connected social accounts.","settings:read":"Read Magistry settings for this store.","settings:write":"Change Magistry settings for this store.","integrations:read":"See which services such as Google, Meta or your mailbox are connected.","integrations:write":"Connect or disconnect services such as Google, Meta or your mailbox.","developer:read":"See the API keys, webhooks and write grants for this store.","developer:write":"Manage API keys and webhooks for this store.","billing:read":"See your plan and credit usage.","marketplaces:read":"Read your marketplace accounts such as bol: offers, content, ads, invoices, returns and replenishments.","marketplaces:write":"Propose changes on your marketplace accounts such as bol prices, stock and ad budgets; you approve each one.","workspace:read":"See your workspace, its members, invitations, roles and security log.","workspace:write":"Propose team changes and stricter workspace security, which an owner or admin approves signed in to Magistry; and replace a store’s request code at once.","admin":"Full store access — read and change everything, including account settings. Does not include finance or social."}}}}}},"paths":{"/api/v1/tools/billing_get":{"post":{"operationId":"billing_get","summary":"This store's plan and credits, as /dashboard/billing shows them: the plan and its status, credits (balance, included in ","description":"This store's plan and credits, as /dashboard/billing shows them: the plan and its status, credits (balance, included in the plan, used this window, bought as overage), the credit window and when it resets, and billing enforcement (active, warning, overage, suspended). All amounts in credits.","tags":["read","billing"],"security":[{"bearerAuth":[]},{"oauth2":["billing:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"Tool result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{}},"required":["ok","result"]}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"502":{"$ref":"#/components/responses/Error502"},"503":{"$ref":"#/components/responses/Error503"}}}},"/api/v1/tools/billing_usage":{"post":{"operationId":"billing_usage","summary":"Credits this store used, grouped. group_by 'purpose' (default): this credit window, by what spent them. 'month': the las","description":"Credits this store used, grouped. group_by 'purpose' (default): this credit window, by what spent them. 'month': the last six billing months, used and added. 'credential': which app or key spent them is not recorded, so the answer is null with reason 'not_attributed' — never a zero.","tags":["read","billing"],"security":[{"bearerAuth":[]},{"oauth2":["billing:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"group_by":{"type":"string","enum":["purpose","month","credential"]}}}}}},"responses":{"200":{"description":"Tool result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{}},"required":["ok","result"]}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"502":{"$ref":"#/components/responses/Error502"},"503":{"$ref":"#/components/responses/Error503"}}}},"/api/v1/tools/billing_invoices_list":{"post":{"operationId":"billing_invoices_list","summary":"This store's billing history for the last six months, in credits: used and added per month, and whether the month carrie","description":"This store's billing history for the last six months, in credits: used and added per month, and whether the month carried an overage charge or a refund. Charged amounts are money and are shown to the store owner at /dashboard/billing (amounts_at), not here.","tags":["read","billing"],"security":[{"bearerAuth":[]},{"oauth2":["billing:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"Tool result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{}},"required":["ok","result"]}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"502":{"$ref":"#/components/responses/Error502"},"503":{"$ref":"#/components/responses/Error503"}}}},"/api/v1/tools/workspace_billing_get":{"post":{"operationId":"workspace_billing_get","summary":"Billing across every store this connection can reach, as /workspace/billing shows it: per store the plan, whether it is ","description":"Billing across every store this connection can reach, as /workspace/billing shows it: per store the plan, whether it is paid, credits (included, used, balance) and AI credits this month; and the totals and plan mix. All amounts in credits.","tags":["read","billing"],"security":[{"bearerAuth":[]},{"oauth2":["billing:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"Tool result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{}},"required":["ok","result"]}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"502":{"$ref":"#/components/responses/Error502"},"503":{"$ref":"#/components/responses/Error503"}}}},"/api/v1/tools/billing_checkout_url":{"post":{"operationId":"billing_checkout_url","summary":"Start subscribing this store to a plan (plan: its id) or buying one credit pack (pack: true). Returns a Magistry link (h","description":"Start subscribing this store to a plan (plan: its id) or buying one credit pack (pack: true). Returns a Magistry link (handoff_url) for the person to open, signed in to Magistry: it is good once, for 15 minutes, only for the person who asked and only if they may manage this store's billing. Never a Stripe link. Stores billed through Shopify are refused: their owner uses /dashboard/billing.","tags":["read","billing"],"security":[{"bearerAuth":[]},{"oauth2":["billing:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"plan":{"type":"string","maxLength":40},"pack":{"type":"boolean","enum":[true]}}}}}},"responses":{"200":{"description":"Tool result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{}},"required":["ok","result"]}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"502":{"$ref":"#/components/responses/Error502"},"503":{"$ref":"#/components/responses/Error503"}}}},"/api/v1/tools/billing_portal_url":{"post":{"operationId":"billing_portal_url","summary":"Open this store's billing portal, where the owner changes the payment method, reads invoices or cancels. Returns a Magis","description":"Open this store's billing portal, where the owner changes the payment method, reads invoices or cancels. Returns a Magistry link (handoff_url) for the person to open, signed in to Magistry: it is good once, for 15 minutes, only for the person who asked and only if they may manage this store's billing. Never a Stripe link. Stores billed through Shopify are refused: their owner uses /dashboard/billing.","tags":["read","billing"],"security":[{"bearerAuth":[]},{"oauth2":["billing:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"Tool result","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"result":{}},"required":["ok","result"]}}}},"400":{"$ref":"#/components/responses/Error400"},"401":{"$ref":"#/components/responses/Error401"},"403":{"$ref":"#/components/responses/Error403"},"404":{"$ref":"#/components/responses/Error404"},"409":{"$ref":"#/components/responses/Error409"},"410":{"$ref":"#/components/responses/Error410"},"413":{"$ref":"#/components/responses/Error413"},"415":{"$ref":"#/components/responses/Error415"},"422":{"$ref":"#/components/responses/Error422"},"429":{"$ref":"#/components/responses/Error429"},"500":{"$ref":"#/components/responses/Error500"},"502":{"$ref":"#/components/responses/Error502"},"503":{"$ref":"#/components/responses/Error503"}}}}}}