{"openapi":"3.1.0","info":{"title":"TradieBridge data API","version":"1","description":"Read your backup's raw documents, exactly as they were copied. The API never changes a source."},"servers":[{"url":"https://app.tradiebridge.com/api/v1"}],"security":[{"apiKey":[]}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"An API key (tbk_…), made by a company admin in Settings → API keys."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}},"paths":{"/connections":{"get":{"operationId":"api_v1_connections_index","summary":"Your sources. A source that leaves this list was removed, with every record it held.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["connections"],"properties":{"connections":{"type":"array"}},"additionalProperties":false}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/changes":{"get":{"operationId":"api_v1_changes_index","summary":"The IDs that changed after a cursor, across your sources. Keep the cursor it returns and send it next time. A webhook only says when to ask.","parameters":[{"name":"cursor","in":"query","required":false,"description":"The cursor the last call answered. Leave it out to start from the oldest change held.","schema":{"type":"string"}},{"name":"resources","in":"query","required":false,"description":"Resource keys, comma-separated, to hear about those only.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"How many changes a page: default 500, at most 1000.","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["connections","changes","cursor","more"],"properties":{"connections":{"type":"array"},"changes":{"type":"array"},"cursor":{"type":["string","null"]},"more":{"type":"boolean"}},"additionalProperties":false}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/connections/{connection_id}/resources":{"get":{"operationId":"api_v1_resources_index","summary":"What a source holds, with the columns a list filters and sorts by.","parameters":[{"name":"connection_id","in":"path","required":true,"description":"A source's id, from /connections.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["resources"],"properties":{"resources":{"type":"array"}},"additionalProperties":false}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/connections/{connection_id}/records/{resource}":{"get":{"operationId":"api_v1_records_index","summary":"A list of records by their stored columns: query, filters, sort, cursor, limit.","parameters":[{"name":"connection_id","in":"path","required":true,"description":"A source's id, from /connections.","schema":{"type":"string"}},{"name":"resource","in":"path","required":true,"description":"A resource key, from that source's /resources.","schema":{"type":"string","examples":["accounts"]}},{"name":"query","in":"query","required":false,"description":"Matches a source ID as a prefix, or a name holding every word.","schema":{"type":"string"}},{"name":"filters","in":"query","required":false,"description":"A JSON object keyed by stored column, e.g. {\"stage\": \"Progress\"}. A value, a list, or an object of operators: eq, ne, in, not_in, gte, lte, contains, null.","schema":{"type":"string"}},{"name":"modified_since","in":"query","required":false,"description":"An ISO 8601 time. Only records modified at or after it.","schema":{"type":"string"}},{"name":"sort","in":"query","required":false,"description":"A stored column, with - before it to sort descending, e.g. -modified_at.","schema":{"type":"string"}},{"name":"cursor","in":"query","required":false,"description":"The cursor the last page answered.","schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"description":"How many records a page: default 50, at most 200.","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["resource","total","records","cursor"],"properties":{"resource":{"type":"string"},"total":{"type":"integer"},"records":{"type":"array"},"cursor":{"type":["string","null"]}},"additionalProperties":false}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/connections/{connection_id}/documents/{resource}":{"get":{"operationId":"api_v1_documents_index","summary":"Up to 100 whole documents by key, and the keys not held.","parameters":[{"name":"connection_id","in":"path","required":true,"description":"A source's id, from /connections.","schema":{"type":"string"}},{"name":"resource","in":"path","required":true,"description":"A resource key, from that source's /resources.","schema":{"type":"string","examples":["accounts"]}},{"name":"keys","in":"query","required":true,"description":"Keys, comma-separated, at most 100.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["documents","missing"],"properties":{"documents":{"type":"array"},"missing":{"type":"array"}},"additionalProperties":false}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/connections/{connection_id}/documents/{resource}/{key}":{"get":{"operationId":"api_v1_documents_show","summary":"One whole document, exactly as the source sent it.","parameters":[{"name":"connection_id","in":"path","required":true,"description":"A source's id, from /connections.","schema":{"type":"string"}},{"name":"resource","in":"path","required":true,"description":"A resource key, from that source's /resources.","schema":{"type":"string","examples":["accounts"]}},{"name":"key","in":"path","required":true,"description":"The record's key, as a list or the change feed answered it.","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["resource","key","data"],"properties":{"resource":{"type":"string"},"key":{"type":["string","integer"]},"data":{"type":"object"}},"additionalProperties":false}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/connections/{connection_id}/answers/{question}":{"get":{"operationId":"api_v1_answers_show","summary":"The common questions, answered from the backup. Each question takes its own arguments as query parameters.","parameters":[{"name":"connection_id","in":"path","required":true,"description":"A source's id, from /connections.","schema":{"type":"string"}},{"name":"question","in":"path","required":true,"description":"A question the source answers, from that source's page in these docs.","schema":{"type":"string","enum":["cash_position","contact_overview","customer_overview","gst","hours","job_overview","job_profitability","labour","payables","quote_conversion","receivables","sales_and_spend","scheduled_work","trips","unreconciled","utilisation"]}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["connection_id","as_of"],"properties":{"connection_id":{"type":"integer"},"as_of":{"type":["string","null"]}},"additionalProperties":true}}}},"401":{"description":"No API key, or one that was revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Not found, or not a source this key reads.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Refused: the error says why (an unknown resource or column, too many keys).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"More than 600 requests a minute or 20,000 requests an hour from one key. Wait the seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/openapi.json":{"get":{"operationId":"api_v1_openapi_show","summary":"This reference as an OpenAPI 3.1 document. It needs no key.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","required":["openapi","info","paths"],"properties":{"openapi":{"type":"string"},"info":{"type":"object"},"paths":{"type":"object"}},"additionalProperties":true}}}}},"security":[]}}}}