{"openapi":"3.1.0","info":{"title":"Invoice Studio API","version":"1.1.0","description":"REST API, webhooks and MCP server of Invoice Studio.\n\n**Auth.** Create a key in Settings → API & webhooks and send `Authorization: Bearer is_…`. Keys made before scopes existed keep working: a read key (is_ro_) has every :read scope plus webhooks:write (REST hook subscribe, as before); a read + write key (is_rw_) has every scope. Test keys (is_test_…) work only inside a separate sandbox workspace filled with sample data; they never see real data, do not count toward the monthly quota, and webhooks from the sandbox carry \"test\": true.\n\n**Errors.** Every error keeps the `error` string and adds `code`, `request_id` and `error_detail` {code, message, request_id}. Every /api/v1 response has an X-Request-Id header.\n\n**Rate limits.** 120 requests per minute and 5,000 per day per key (MCP calls count). Headers: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (unix time the minute window ends), X-RateLimit-Limit-Day, X-RateLimit-Remaining-Day; a 429 adds Retry-After (seconds).\n\n**Monthly quotas** (per plan, set by the site owner): API calls (api_calls_month) and AI actions (ai_actions_month = MCP write tools). Header X-Quota-Remaining (API calls; 'unlimited' when there is no cap) and X-Quota-Remaining-AI on MCP writes. Over the quota: 402 with code quota_exceeded.\n\n**Pagination.** List endpoints take `limit` (1–200, default 50) and `cursor` (opaque; pass next_cursor from the previous page). Responses add `next_cursor` (null on the last page) and `has_more`. Order: newest id first.\n\n**Idempotency.** POST /clients, /deals, /invoices and MCP write tools accept an Idempotency-Key header (1–255 visible ASCII characters). Same key + same API key within 24 h returns the first response with Idempotent-Replayed: true; the same key with a different body gives 422 idempotency_mismatch; a request still running gives 409 idempotency_in_progress."},"servers":[{"url":"https://invoicestudio.cc"}],"security":[{"apiKey":[]}],"tags":[{"name":"REST"},{"name":"MCP"},{"name":"OAuth"}],"paths":{"/api/v1/me":{"get":{"summary":"Who owns this key","description":"For \"test authentication\" in Zapier / Make. Any valid key.","security":[{"apiKey":[]}],"responses":{"200":{"description":"Account","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"business":{"type":"string"}}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/invoices":{"get":{"summary":"List invoices","description":"Invoices and other documents (quotes, credit notes…) of the business. Filter by updated_since (updated_at).","x-required-scope":"invoices:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"$ref":"#/components/parameters/updated_since"}],"responses":{"200":{"description":"One page, newest first","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/InvoiceSummary"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Create an invoice","description":"Creates an invoice (status sent, or paid with mark_paid) for an existing client_id or a client object (found by email / phone or added). Send an Idempotency-Key header to make retries safe: the same key with the same body returns the first response for 24 hours (header Idempotent-Replayed: true).","x-required-scope":"invoices:write","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"client_id":{"type":"integer"},"client":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"company":{"type":"string"}}},"currency":{"type":"string","example":"USD"},"items":{"type":"array","maxItems":100,"items":{"type":"object","required":["description"],"properties":{"description":{"type":"string"},"quantity":{"type":"number","default":1},"rate":{"type":"number"}}}},"due_date":{"type":"string","format":"date"},"notes":{"type":"string"},"reference":{"type":"string","maxLength":60},"source":{"type":"string"},"mark_paid":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Created","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"number":{"type":"string"},"status":{"type":"string"},"currency":{"type":"string"},"total":{"type":"number"},"balance":{"type":"number"},"link":{"type":"string","format":"uri"}}}}}}}},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/invoices/{id}":{"get":{"summary":"One invoice with items and payments","x-required-scope":"invoices:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"The record","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Invoice"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/clients":{"get":{"summary":"List clients","description":"Customers and CRM contacts. Filter by updated_since (updated_at).","x-required-scope":"clients:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"$ref":"#/components/parameters/updated_since"}],"responses":{"200":{"description":"One page, newest first","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Client"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Add a client / contact","description":"Runs the same checks and automations as adding a contact in the app. Send an Idempotency-Key header to make retries safe: the same key with the same body returns the first response for 24 hours (header Idempotent-Replayed: true).","x-required-scope":"clients:write","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"company":{"type":"string"},"address":{"type":"string"},"lifecycle":{"type":"string","enum":["lead","prospect","customer","inactive"]},"tags":{"type":"string","description":"Comma separated"},"source":{"type":"string"},"notes":{"type":"string"},"website":{"type":"string"},"job_title":{"type":"string"},"custom_fields":{"type":"object","description":"Your contact custom fields: {field_key: value}"}}}}}},"responses":{"201":{"description":"Created","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Client"}}}}}},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/clients/{id}":{"get":{"summary":"One client","x-required-scope":"clients:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"The record","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Client"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/deals":{"get":{"summary":"List CRM deals","description":"Deals with their stage. Filter by updated_since (updated_at).","x-required-scope":"deals:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"$ref":"#/components/parameters/updated_since"}],"responses":{"200":{"description":"One page, newest first","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Deal"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Add a CRM deal","description":"Goes into the first stage of your default pipeline unless stage_id (or pipeline_id / pipeline) is given. Send an Idempotency-Key header to make retries safe: the same key with the same body returns the first response for 24 hours (header Idempotent-Replayed: true).","x-required-scope":"deals:write","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["title"],"properties":{"title":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"stage_id":{"type":"integer"},"client_id":{"type":"integer"},"new_client":{"type":"string","description":"Name of a new contact to add with the deal"},"close_date":{"type":"string","format":"date"},"source":{"type":"string"},"notes":{"type":"string"},"pipeline_id":{"type":"integer","description":"Pipeline to add it to (first stage). Default: your default pipeline"},"pipeline":{"type":"string","description":"Or the pipeline name"},"custom_fields":{"type":"object","description":"Your deal custom fields: {field_key: value}"}}}}}},"responses":{"201":{"description":"Created","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"status":{"type":"string","enum":["open","won","lost"]},"pipeline_id":{"type":"integer"},"custom_fields":{"type":"object"}}}}}}}},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/ValidationError"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/deals/{id}":{"get":{"summary":"One deal","x-required-scope":"deals:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"The record","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Deal"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/payments":{"get":{"summary":"List payments","description":"Payments received. Payments are never edited, so updated_since filters on created_at (when the payment was recorded).","x-required-scope":"payments:read","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/limit"},{"$ref":"#/components/parameters/cursor"},{"$ref":"#/components/parameters/updated_since"}],"responses":{"200":{"description":"One page, newest first","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Page"},{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}}}}]}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/hooks":{"get":{"summary":"List REST hook subscriptions","x-required-scope":"webhooks:read","security":[{"apiKey":[]}],"responses":{"200":{"description":"Hooks and the event list","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object"}},"events":{"type":"object","additionalProperties":{"type":"string"}}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"summary":"Subscribe a REST hook (Zapier / Make)","x-required-scope":"webhooks:write","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["target_url","event"],"properties":{"target_url":{"type":"string","format":"uri","description":"Public https:// address"},"event":{"type":"string","enum":["invoice.paid","quote.accepted","contact.created","deal.created","deal.won","deal.lost","deal.stage","order.created","order.status","shop.order","ticket.created","contract.signed","meeting.booked","bill.created","subscription.created","subscription.cancelled"]}}}}}},"responses":{"201":{"description":"Subscribed. Keep the secret to verify signatures.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"event":{"type":"string"},"secret":{"type":"string"}}}}}},"422":{"$ref":"#/components/responses/ValidationError"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/hooks/{id}":{"delete":{"summary":"Unsubscribe a REST hook","x-required-scope":"webhooks:write","security":[{"apiKey":[]}],"parameters":[{"$ref":"#/components/parameters/id"}],"responses":{"200":{"description":"Removed","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/hooks/sample/{event}":{"get":{"summary":"Sample event (Zapier \"perform list\")","description":"The newest real record shaped as the event, or a made-up example.","security":[{"apiKey":[]}],"parameters":[{"name":"event","in":"path","required":true,"schema":{"type":"string","enum":["invoice.paid","quote.accepted","contact.created","deal.created","deal.won","deal.lost","deal.stage","order.created","order.status","shop.order","ticket.created","contract.signed","meeting.booked","bill.created","subscription.created","subscription.cancelled"]}}],"responses":{"200":{"description":"A list with one sample event","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/WebhookEvent"}}}}},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/QuotaExceeded"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/mcp":{"post":{"summary":"MCP server (JSON-RPC 2.0, Streamable HTTP, JSON responses)","description":"One JSON-RPC message per POST: initialize, ping, tools/list, tools/call. Auth: an API key or an OAuth access token (see the oauth2 scheme). A 401 carries WWW-Authenticate: Bearer resource_metadata=\"https://invoicestudio.cc/.well-known/oauth-protected-resource\". Read tools need mcp:read, changes mcp:write, request_invoice_send mcp:send_invoice; a key can also limit the tools. MCP never emails invoices or takes payments by itself. Write tools accept an Idempotency-Key header (or params._meta.idempotency_key). Every tools/call is in the activity log.","x-required-scope":"mcp:read","security":[{"apiKey":[]},{"oauth2":["mcp:read"]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["jsonrpc","method"],"properties":{"jsonrpc":{"const":"2.0"},"id":{"type":["string","integer"]},"method":{"type":"string","enum":["initialize","ping","tools/list","tools/call","notifications/initialized"]},"params":{"type":"object"}}}}}},"responses":{"200":{"description":"JSON-RPC response","headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"type":"object"}}}},"202":{"description":"Notification accepted (no body)"},"401":{"description":"Missing or bad credentials","headers":{"WWW-Authenticate":{"schema":{"type":"string"}}}},"402":{"$ref":"#/components/responses/QuotaExceeded"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/api/v1/openapi.json":{"get":{"summary":"This document","security":[],"responses":{"200":{"description":"OpenAPI 3.1","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/api/v1/oauth/register":{"post":{"summary":"OAuth dynamic client registration (RFC 7591)","description":"For MCP clients such as ChatGPT connectors. Redirect URIs must be https:// (http://localhost and 127.0.0.1 allowed for local apps). Rate limited per IP.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["redirect_uris"],"properties":{"client_name":{"type":"string"},"redirect_uris":{"type":"array","items":{"type":"string","format":"uri"}},"token_endpoint_auth_method":{"type":"string","enum":["none","client_secret_post","client_secret_basic"]},"grant_types":{"type":"array","items":{"type":"string"}},"client_uri":{"type":"string"}}}}}},"responses":{"201":{"description":"Registered (client_secret only for confidential clients)","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"description":"invalid_redirect_uri / invalid_client_metadata","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"429":{"description":"Too many registrations"}}}},"/api/v1/oauth/token":{"post":{"summary":"OAuth token endpoint","description":"grant_type=authorization_code (PKCE S256 code_verifier required) or refresh_token (rotated on every use; reusing an old refresh token ends the connection). Access tokens last 1 hour, refresh tokens 30 days.","security":[],"requestBody":{"required":true,"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["grant_type","client_id"],"properties":{"grant_type":{"type":"string","enum":["authorization_code","refresh_token"]},"client_id":{"type":"string"},"client_secret":{"type":"string"},"code":{"type":"string"},"redirect_uri":{"type":"string"},"code_verifier":{"type":"string"},"refresh_token":{"type":"string"},"resource":{"type":"string"}}}}}},"responses":{"200":{"description":"Tokens","content":{"application/json":{"schema":{"type":"object","properties":{"access_token":{"type":"string"},"token_type":{"const":"Bearer"},"expires_in":{"type":"integer"},"refresh_token":{"type":"string"},"scope":{"type":"string"}}}}}},"400":{"description":"invalid_grant / unsupported_grant_type / invalid_scope","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}},"401":{"description":"invalid_client","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthError"}}}}}}},"/api/v1/oauth/revoke":{"post":{"summary":"Revoke a token (RFC 7009)","description":"Revoking a refresh token disconnects the app. Always 200.","security":[],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"token":{"type":"string"},"client_id":{"type":"string"}}}}}},"responses":{"200":{"description":"Done"}}}},"/.well-known/oauth-protected-resource":{"get":{"summary":"Protected resource metadata (RFC 9728) for the MCP server","security":[],"responses":{"200":{"description":"Metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}},"/.well-known/oauth-authorization-server":{"get":{"summary":"Authorization server metadata (RFC 8414)","security":[],"responses":{"200":{"description":"Metadata","content":{"application/json":{"schema":{"type":"object"}}}}}}}},"webhooks":{"bill.created":{"post":{"summary":"Supplier bill added","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"bill.created"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_bill.created","event":"bill.created","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"contact.created":{"post":{"summary":"New contact or lead","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"contact.created"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_contact.created","event":"contact.created","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"contract.signed":{"post":{"summary":"Contract signed","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"contract.signed"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_contract.signed","event":"contract.signed","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"deal.created":{"post":{"summary":"New deal","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"deal.created"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_deal.created","event":"deal.created","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"deal.lost":{"post":{"summary":"Deal lost","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"deal.lost"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_deal.lost","event":"deal.lost","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"deal.stage":{"post":{"summary":"Deal changed stage","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"deal.stage"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_deal.stage","event":"deal.stage","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"deal.won":{"post":{"summary":"Deal won","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"deal.won"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_deal.won","event":"deal.won","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"invoice.overdue":{"post":{"summary":"invoice.overdue","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"invoice.overdue"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_invoice.overdue","event":"invoice.overdue","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"invoice.paid":{"post":{"summary":"Invoice paid in full","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"invoice.paid"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_invoice.paid","event":"invoice.paid","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"meeting.booked":{"post":{"summary":"Meeting booked","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"meeting.booked"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_meeting.booked","event":"meeting.booked","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"order.created":{"post":{"summary":"New client order","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"order.created"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_order.created","event":"order.created","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"order.status":{"post":{"summary":"Order status changed","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"order.status"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_order.status","event":"order.status","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"payment.received":{"post":{"summary":"payment.received","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"payment.received"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_payment.received","event":"payment.received","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"quote.accepted":{"post":{"summary":"Quote accepted","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"quote.accepted"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_quote.accepted","event":"quote.accepted","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"shop.order":{"post":{"summary":"New online order (Shopify, WooCommerce)","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"shop.order"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_shop.order","event":"shop.order","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"subscription.cancelled":{"post":{"summary":"Subscription cancelled","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"subscription.cancelled"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_subscription.cancelled","event":"subscription.cancelled","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"subscription.created":{"post":{"summary":"Subscription started","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"subscription.created"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_subscription.created","event":"subscription.created","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}},"ticket.created":{"post":{"summary":"New support ticket","description":"POSTed to your webhook / REST hook. Verify X-InvoiceStudio-Signature: t=<unix>,v1=hex(HMAC-SHA256(secret, \"<t>.<raw body>\")). Events from the test sandbox carry \"test\": true.","parameters":[{"name":"X-InvoiceStudio-Event","in":"header","schema":{"type":"string","const":"ticket.created"}},{"name":"X-InvoiceStudio-Signature","in":"header","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEvent"},"example":{"id":"evt_sample_ticket.created","event":"ticket.created","created_at":"2026-11-30T08:54:08+00:00","data":{"contact":{"id":1,"name":"Ayesha Rahman","email":"ayesha@example.com","phone":"+8801700000000","source":"Facebook Lead Ads"},"invoice":{"id":1,"number":"INV-0001","status":"paid","currency":"USD","total":250,"balance":0}}}}}},"responses":{"200":{"description":"Any 2xx = delivered. A 410 Gone removes a REST hook; repeated failures switch a hook off."}}}}},"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","bearerFormat":"is_ro_… | is_rw_… | is_test_…","description":"API key from Settings → API & webhooks. Scopes: invoices:read, invoices:write, clients:read, clients:write, deals:read, deals:write, payments:read, webhooks:read, webhooks:write, mcp:read, mcp:write, mcp:send_invoice."},"oauth2":{"type":"oauth2","description":"For MCP clients (e.g. ChatGPT connectors). Authorization code + PKCE (S256) with dynamic client registration. Only the MCP endpoint accepts OAuth tokens. Discovery: https://invoicestudio.cc/.well-known/oauth-authorization-server","flows":{"authorizationCode":{"authorizationUrl":"https://invoicestudio.cc/oauth/authorize","tokenUrl":"https://invoicestudio.cc/api/v1/oauth/token","refreshUrl":"https://invoicestudio.cc/api/v1/oauth/token","scopes":{"mcp:read":"AI assistant (MCP): read invoices, clients, deals, orders and payments","mcp:write":"AI assistant (MCP): make draft invoices, move deals, add orders, tasks and messages","mcp:send_invoice":"AI assistant (MCP): ask you to approve sending an invoice (never sends by itself)"}}}}},"parameters":{"id":{"name":"id","in":"path","required":true,"schema":{"type":"integer"}},"limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200,"default":50}},"cursor":{"name":"cursor","in":"query","description":"next_cursor from the previous page","schema":{"type":"string"}},"updated_since":{"name":"updated_since","in":"query","description":"YYYY-MM-DD or YYYY-MM-DD HH:MM:SS (UTC)","schema":{"type":"string"}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","schema":{"type":"string","maxLength":255}}},"headers":{"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"responses":{"BadRequest":{"description":"Bad request (e.g. invalid_cursor, invalid_idempotency_key)","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing, invalid or revoked key (unauthorized, invalid_key, oauth_not_allowed)","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Forbidden":{"description":"insufficient_scope, tool_not_allowed or api_disabled","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"not_found / unknown_endpoint","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"idempotency_in_progress","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ValidationError":{"description":"validation_error / idempotency_mismatch","headers":{"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"QuotaExceeded":{"description":"quota_exceeded: the plan's monthly API calls or AI actions are used up","headers":{"X-Quota-Remaining":{"schema":{"type":"string"}},"X-Request-Id":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"RateLimited":{"description":"rate_limited","headers":{"Retry-After":{"schema":{"type":"integer"}},"X-Request-Id":{"schema":{"type":"string"}},"X-RateLimit-Limit":{"schema":{"type":"integer"}},"X-RateLimit-Remaining":{"schema":{"type":"integer"}},"X-RateLimit-Reset":{"schema":{"type":"integer"},"description":"Unix time"},"X-RateLimit-Limit-Day":{"schema":{"type":"integer"}},"X-RateLimit-Remaining-Day":{"schema":{"type":"integer"}},"X-Quota-Remaining":{"schema":{"type":"string"},"description":"API calls left this month, or \"unlimited\""}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error","code","request_id"],"properties":{"error":{"type":"string","description":"Human message (kept for older clients)"},"code":{"type":"string"},"request_id":{"type":"string"},"errors":{"type":"object","description":"Field errors, when any"},"error_detail":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"}}}}},"OAuthError":{"type":"object","properties":{"error":{"type":"string"},"error_description":{"type":"string"}}},"Page":{"type":"object","required":["data","next_cursor","has_more"],"properties":{"data":{"type":"array"},"next_cursor":{"type":["string","null"]},"has_more":{"type":"boolean"}}},"InvoiceSummary":{"type":"object","properties":{"id":{"type":"integer"},"number":{"type":"string"},"doc_type":{"type":"string"},"status":{"type":"string","enum":["draft","sent","partial","paid","void"]},"issue_date":{"type":"string"},"due_date":{"type":["string","null"]},"currency":{"type":"string"},"total":{"type":"number"},"amount_paid":{"type":"number"},"balance":{"type":"number"},"client_id":{"type":["integer","null"]},"deal_id":{"type":["integer","null"]},"updated_at":{"type":"string"}}},"Invoice":{"type":"object","description":"Full invoice: header fields, from / to parties, items, totals, payments.","additionalProperties":true},"Client":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"company":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string"},"address":{"type":"string"},"lifecycle":{"type":"string"},"tags":{"type":"string"},"source":{"type":"string"},"website":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}}},"Deal":{"type":"object","properties":{"id":{"type":"integer"},"title":{"type":"string"},"value":{"type":"number"},"currency":{"type":"string"},"status":{"type":"string","enum":["open","won","lost"]},"stage":{"type":"string"},"client_id":{"type":["integer","null"]},"close_date":{"type":["string","null"]},"source":{"type":"string"},"created_at":{"type":"string"},"updated_at":{"type":"string"}}},"Payment":{"type":"object","properties":{"id":{"type":"integer"},"invoice_id":{"type":"integer"},"number":{"type":"string"},"amount":{"type":"number"},"currency":{"type":"string"},"paid_on":{"type":"string"},"method":{"type":"string"},"note":{"type":"string"},"created_at":{"type":"string"}}},"WebhookEvent":{"type":"object","required":["id","event","created_at","data"],"properties":{"id":{"type":"string"},"event":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object"},"test":{"type":"boolean","description":"Present (true) only for events from the test sandbox"}}}}},"x-scopes":{"invoices:read":"Read invoices","invoices:write":"Create invoices","clients:read":"Read clients and contacts","clients:write":"Add clients and contacts","deals:read":"Read CRM deals","deals:write":"Add CRM deals","payments:read":"Read payments","webhooks:read":"List webhook subscriptions","webhooks:write":"Subscribe and unsubscribe webhooks (Zapier / Make REST hooks)","mcp:read":"AI assistant (MCP): read invoices, clients, deals, orders and payments","mcp:write":"AI assistant (MCP): make draft invoices, move deals, add orders, tasks and messages","mcp:send_invoice":"AI assistant (MCP): ask you to approve sending an invoice (never sends by itself)"},"x-key-presets":{"read":{"label":"Read only","scopes":["invoices:read","clients:read","deals:read","payments:read","webhooks:read","mcp:read"],"mcp_tools":"all"},"zapier":{"label":"Zapier / Make","scopes":["invoices:read","invoices:write","clients:read","clients:write","deals:read","deals:write","payments:read","webhooks:read","webhooks:write"],"mcp_tools":"all"},"ai":{"label":"AI assistant (safe)","scopes":["mcp:read","mcp:write","mcp:send_invoice"],"mcp_tools":["list_orders","get_order","list_clients","list_invoices","find_client","get_client","list_deals","get_payment_status","update_deal_stage","draft_invoice","request_invoice_send","create_task"]},"full":{"label":"Full access","scopes":["invoices:read","invoices:write","clients:read","clients:write","deals:read","deals:write","payments:read","webhooks:read","webhooks:write","mcp:read","mcp:write","mcp:send_invoice"],"mcp_tools":"all"}},"x-rate-limits":{"per_minute":120,"per_day":5000,"scope":"per API key / per OAuth connection; MCP calls count"},"x-quotas":{"api_calls_month":"API calls per month","ai_actions_month":"AI assistant actions per month (MCP changes)","error_code":"quota_exceeded","status":402},"x-mcp":{"url":"https://invoicestudio.cc/api/v1/mcp","protocol_versions":["2025-06-18","2025-03-26","2024-11-05"],"tools":[{"name":"list_orders","title":"List orders","description":"List client work orders (newest and most urgent first). Optional filter by status and a search text (title, client name or order number).","scope":"mcp:read","read_only":true,"needs_client_work":true},{"name":"get_order","title":"Get an order","description":"Full details of one order by its number (e.g. 1002): client, status, due date, tasks, recent messages, files, invoice and the client link.","scope":"mcp:read","read_only":true,"needs_client_work":true},{"name":"create_order","title":"Create an order","description":"Create a new order for a client from one of your services. The client contact is found by email or created. Set notify to email the client their order link.","scope":"mcp:write","read_only":false,"needs_client_work":true},{"name":"list_clients","title":"List clients","description":"List or search your contacts (name, company, email or phone).","scope":"mcp:read","read_only":true,"needs_client_work":false},{"name":"list_invoices","title":"List invoices","description":"List invoices, newest first. Optional status filter.","scope":"mcp:read","read_only":true,"needs_client_work":false},{"name":"create_task","title":"Add a task","description":"Add a task to an order's checklist. Set internal to hide it from the client.","scope":"mcp:write","read_only":false,"needs_client_work":true},{"name":"add_order_message","title":"Message on an order","description":"Post a message on an order. The client sees it on their order page and gets an email. Set internal to write a team-only note instead.","scope":"mcp:write","read_only":false,"needs_client_work":true},{"name":"find_client","title":"Find a client","description":"Search clients by name, company, email or phone. Each match comes with the money it still owes (unpaid invoice balances per currency) and its number of open invoices.","scope":"mcp:read","read_only":true,"needs_client_work":false},{"name":"get_client","title":"Get a client","description":"One client by id or email: contact details, outstanding balance, the latest invoices and open deals.","scope":"mcp:read","read_only":true,"needs_client_work":false},{"name":"list_deals","title":"List deals","description":"CRM deals, newest first. Filter by stage name, status (open, won, lost) or a search text.","scope":"mcp:read","read_only":true,"needs_client_work":false},{"name":"update_deal_stage","title":"Move a deal to another stage","description":"Move a CRM deal to another pipeline stage (by stage name or id). For safety it cannot mark a deal Won, and it refuses a move that would start an automation which emails an invoice: the owner does those in the app.","scope":"mcp:write","read_only":false,"needs_client_work":false},{"name":"get_payment_status","title":"Payment status of an invoice","description":"Is an invoice paid? By invoice number: status, total, paid so far, balance, due date, days overdue, each payment and the client pay link.","scope":"mcp:read","read_only":true,"needs_client_work":false},{"name":"draft_invoice","title":"Draft an invoice","description":"Create a DRAFT invoice for a client. It is never sent: the owner reviews it in the app (the result has the link). To ask for it to be sent, use request_invoice_send.","scope":"mcp:write","read_only":false,"needs_client_work":false},{"name":"request_invoice_send","title":"Ask the owner to send an invoice","description":"Does NOT send anything. Creates a request the business owner sees in the app (bell + Settings → API & webhooks → AI requests). Only when the owner approves is the invoice emailed to the client. Requests expire after 7 days.","scope":"mcp:send_invoice","read_only":false,"needs_client_work":false}],"guardrails":["draft_invoice creates drafts only","request_invoice_send only creates an approval request; the owner approves in the app and only then is the invoice emailed; requests expire after 7 days","update_deal_stage cannot mark a deal Won and refuses moves that would start an automation which emails an invoice","no tool takes payments"]}}