{"openapi":"3.1.0","info":{"title":"bancapi","version":"1","description":"Bank accounts and movements of your companies, synced from Banco de Chile Empresas and Banco BICE Empresas. Personal accounts at Banco BICE Personas show as a company under the person's own RUT. Read-only, except for triggering a sync. Authenticate with an API token from the web app: `Authorization: Bearer \u003ctoken\u003e`. Amounts are strings with decimals to avoid float rounding."},"servers":[{"url":"https://bancapi.fitoexact.com"}],"security":[{"bearer":[]}],"paths":{"/api/v1/companies":{"get":{"summary":"List companies","description":"Every company (empresa, by RUT) with its accounts at every bank.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Company"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/v1/companies/{id}":{"get":{"summary":"Get a company","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Company"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/v1/accounts":{"get":{"summary":"List accounts","description":"Every bank account with balance and company.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/v1/accounts/{id}":{"get":{"summary":"Get an account","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/v1/movements":{"get":{"summary":"Search movements","description":"All movements across banks and companies, filtered and paged.","parameters":[{"name":"company_id","in":"query","required":false,"description":"Only this company's movements (id from /companies).","schema":{"type":"integer"}},{"name":"company_rut","in":"query","required":false,"description":"Only this company's movements, by RUT in any format (77.945.259-K, 77945259K…).","schema":{"type":"string"}},{"name":"account_id","in":"query","required":false,"description":"Only this account's movements.","schema":{"type":"integer"}},{"name":"bank","in":"query","required":false,"description":"Only accounts at this bank.","schema":{"type":"string","enum":["banco_de_chile_empresas","banco_bice_empresas","banco_bice_personas"]}},{"name":"currency","in":"query","required":false,"description":"Only accounts in this currency, e.g. CLP or USD.","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"Movements on or after this date (YYYY-MM-DD).","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Movements on or before this date (YYYY-MM-DD).","schema":{"type":"string","format":"date"}},{"name":"kind","in":"query","required":false,"description":"credit (money in) or debit (money out).","schema":{"type":"string","enum":["credit","debit"]}},{"name":"counterparty_rut","in":"query","required":false,"description":"The other party's RUT, any format. Check digit is validated.","schema":{"type":"string"}},{"name":"counterparty","in":"query","required":false,"description":"Text contained in the other party's name (case-insensitive).","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Text contained in the description (case-insensitive).","schema":{"type":"string"}},{"name":"min_amount","in":"query","required":false,"description":"Minimum absolute amount.","schema":{"type":"number"}},{"name":"max_amount","in":"query","required":false,"description":"Maximum absolute amount.","schema":{"type":"number"}},{"name":"sort","in":"query","required":false,"description":"Order of results (default date_desc).","schema":{"type":"string","enum":["date_desc","date_asc","amount_desc","amount_asc"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer"}},{"name":"per_page","in":"query","required":false,"description":"Results per page (default 100, max 500).","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Movement"}}}},"headers":{"X-Total-Count":{"description":"Movements matching the filters","schema":{"type":"integer"}},"X-Page":{"description":"This page","schema":{"type":"integer"}},"X-Per-Page":{"description":"Page size","schema":{"type":"integer"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"400":{"$ref":"#/components/responses/InvalidFilter"}}}},"/api/v1/accounts/{account_id}/movements":{"get":{"summary":"Search one account's movements","description":"Same filters, limited to one account.","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"integer"}},{"name":"company_id","in":"query","required":false,"description":"Only this company's movements (id from /companies).","schema":{"type":"integer"}},{"name":"company_rut","in":"query","required":false,"description":"Only this company's movements, by RUT in any format (77.945.259-K, 77945259K…).","schema":{"type":"string"}},{"name":"account_id","in":"query","required":false,"description":"Only this account's movements.","schema":{"type":"integer"}},{"name":"bank","in":"query","required":false,"description":"Only accounts at this bank.","schema":{"type":"string","enum":["banco_de_chile_empresas","banco_bice_empresas","banco_bice_personas"]}},{"name":"currency","in":"query","required":false,"description":"Only accounts in this currency, e.g. CLP or USD.","schema":{"type":"string"}},{"name":"from","in":"query","required":false,"description":"Movements on or after this date (YYYY-MM-DD).","schema":{"type":"string","format":"date"}},{"name":"to","in":"query","required":false,"description":"Movements on or before this date (YYYY-MM-DD).","schema":{"type":"string","format":"date"}},{"name":"kind","in":"query","required":false,"description":"credit (money in) or debit (money out).","schema":{"type":"string","enum":["credit","debit"]}},{"name":"counterparty_rut","in":"query","required":false,"description":"The other party's RUT, any format. Check digit is validated.","schema":{"type":"string"}},{"name":"counterparty","in":"query","required":false,"description":"Text contained in the other party's name (case-insensitive).","schema":{"type":"string"}},{"name":"q","in":"query","required":false,"description":"Text contained in the description (case-insensitive).","schema":{"type":"string"}},{"name":"min_amount","in":"query","required":false,"description":"Minimum absolute amount.","schema":{"type":"number"}},{"name":"max_amount","in":"query","required":false,"description":"Maximum absolute amount.","schema":{"type":"number"}},{"name":"sort","in":"query","required":false,"description":"Order of results (default date_desc).","schema":{"type":"string","enum":["date_desc","date_asc","amount_desc","amount_asc"]}},{"name":"page","in":"query","required":false,"description":"Page number, from 1.","schema":{"type":"integer"}},{"name":"per_page","in":"query","required":false,"description":"Results per page (default 100, max 500).","schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Movement"}}}},"headers":{"X-Total-Count":{"description":"Movements matching the filters","schema":{"type":"integer"}},"X-Page":{"description":"This page","schema":{"type":"integer"}},"X-Per-Page":{"description":"Page size","schema":{"type":"integer"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"400":{"$ref":"#/components/responses/InvalidFilter"}}}},"/api/v1/movements/{id}":{"get":{"summary":"Get a movement","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Movement"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/v1/bank_connections":{"get":{"summary":"List bank connections","description":"Sync status per bank login. Credentials are never returned.","parameters":[],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Connection"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/api/v1/bank_connections/{id}":{"get":{"summary":"Get a bank connection","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Connection"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/v1/bank_connections/{id}/sync":{"post":{"summary":"Queue a sync","description":"Banks that sync from the server only (Banco de Chile). Extension-only banks answer 422.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"202":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"const":"queued"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/v1/bank_connections/{bank_connection_id}/imports":{"post":{"summary":"Upload from the connector extension","description":"Used by the bancapi connector Chrome extension; the payload is the bank portal's own JSON.","parameters":[{"name":"bank_connection_id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"accounts":{"type":"integer"},"movements_seen":{"type":"integer"},"movements_created":{"type":"integer"}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"API token (bk_…)"}},"schemas":{"Company":{"type":"object","properties":{"id":{"type":"integer"},"rut":{"type":"string","examples":["77945259-K"]},"name":{"type":"string"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/Account"}}}},"Account":{"type":"object","properties":{"id":{"type":"integer"},"bank_connection_id":{"type":"integer"},"bank":{"type":"string","enum":["banco_de_chile_empresas","banco_bice_empresas","banco_bice_personas"]},"number":{"type":"string"},"product_code":{"type":["string","null"]},"currency":{"type":"string"},"company":{"type":["object","null"],"properties":{"id":{"type":"integer"},"rut":{"type":"string"},"name":{"type":"string"}}},"balance":{"type":["string","null"],"description":"Decimal as string, e.g. \"1500000.0\""},"balance_at":{"type":["string","null"]}}},"Movement":{"type":"object","properties":{"id":{"type":"integer"},"external_id":{"type":"string","description":"The bank's own id, stable across syncs"},"account":{"type":"object","properties":{"id":{"type":"integer"},"number":{"type":"string"},"bank":{"type":"string"}}},"company":{"type":["object","null"],"properties":{"id":{"type":"integer"},"rut":{"type":"string"},"name":{"type":"string"}}},"date":{"type":"string","format":"date"},"posted_at":{"type":["string","null"],"format":"date-time"},"kind":{"type":"string","enum":["credit","debit"]},"currency":{"type":"string"},"amount":{"type":"string","description":"Absolute amount"},"signed_amount":{"type":"string","description":"Negative for debits"},"balance_after":{"type":["string","null"],"description":"Decimal as string, e.g. \"1500000.0\""},"description":{"type":["string","null"]},"channel":{"type":["string","null"]},"document_number":{"type":["string","null"]},"transaction_code":{"type":["string","null"]},"counterparty":{"type":"object","properties":{"name":{"type":["string","null"]},"rut":{"type":["string","null"]},"account":{"type":["string","null"]},"source":{"type":["string","null"],"enum":["glosa","description",null],"description":"Where the RUT came from: the transfer detail or the description text"}}}}},"Connection":{"type":"object","properties":{"id":{"type":"integer"},"bank":{"type":"string","enum":["banco_de_chile_empresas","banco_bice_empresas","banco_bice_personas"]},"name":{"type":"string"},"status":{"type":"string","enum":["pending","active","failing"]},"last_synced_at":{"type":["string","null"]},"last_error":{"type":["string","null"]},"account_ids":{"type":"array","items":{"type":"integer"}},"sync_from":{"type":["string","null"],"format":"date","description":"Where the next extension upload should start"}}},"Error":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}},"required":["error"]}},"responses":{"Unauthorized":{"description":"Missing or invalid token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Not found, or not yours.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InvalidFilter":{"description":"A filter has an invalid value; `message` names it.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}