{"openapi":"3.0.0","info":{"title":"Accounts API (DRAFT)","version":"0.0.1","contact":{"name":"Slate","email":"support@slate.inc"},"description":"**DRAFT. Shapes, names, and field sets may change before this is finalized**\nThe Accounts API is how a owner keeps Slate's view of its accounts in sync. An **account** is the primary data entity that Slate services against, mapping to the originating account that the debt is associated with.\n**Two identifiers.** Slate assigns each account a stable UUID, `accountId` — this is the canonical id and the key for every read and targeted update. You also carry your own identifier for the account, `externalAccountId` (the account number in your system), which is unique within your organization (`owner`). You do not know Slate's `accountId` until the account has been created, so the first write is an **upsert** keyed on your `externalAccountId`; the response returns the assigned `accountId`, which you use from then on (and can re-resolve any time via `GET /v1/accounts?externalAccountId=...`).\n**Upsert.** `POST /v1/accounts` idempotently creates the account if new or updates it if one already exists for your `(owner, externalAccountId)`. Send the account's current state as a full snapshot — this is how a daily inventory feed keeps Slate in sync. Targeted updates use a partial `PATCH /v1/accounts/{accountId}` — send only the fields that changed (balance, status, placement, legal, …) — for owners that prefer not to resend the whole account.\n**Scoping & auth.** Every request is scoped to a single `owner`, derived from your bearer token; `externalAccountId` is unique only within an owner. Multi-owner service credentials may pass an explicit `owner` on read endpoints.\n**Money.** All monetary amounts are in whole **US dollars with two decimal places** (e.g. `1250.75`). Do not send minor units (cents)."},"servers":[{"url":"https://api.slate.inc","description":"Production"}],"security":[{"bearerAuth":[]}],"paths":{"/v1/accounts":{"get":{"operationId":"listAccounts","summary":"List accounts","description":"Returns a page of accounts for the caller's owner, newest-updated first by default. Filter by `externalAccountId` to resolve one of your accounts to its Slate `accountId`. Use `cursor` to page; `nextCursor` is empty on the last page.","parameters":[{"$ref":"#/components/parameters/Owner"},{"name":"externalAccountId","in":"query","required":false,"description":"Return only the account with this identifier in your system (exact match) — the way to look up its Slate `accountId`.","schema":{"type":"string"}},{"name":"status","in":"query","required":false,"description":"Restrict to accounts in this lifecycle status.","schema":{"$ref":"#/components/schemas/AccountStatus"}},{"name":"limit","in":"query","required":false,"description":"Maximum number of accounts to return.","schema":{"type":"integer","default":100,"minimum":1,"maximum":500}},{"name":"cursor","in":"query","required":false,"description":"Opaque cursor from a previous response's `nextCursor`.","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of accounts.","content":{"application/json":{"schema":{"type":"object","required":["data","totalCount","nextCursor"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Account"}},"totalCount":{"type":"integer","description":"Total accounts matching the query, across all pages."},"nextCursor":{"type":"string","description":"Cursor for the next page; empty string when there are no more."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}},"post":{"operationId":"upsertAccount","summary":"Create or update an account (upsert)","description":"Idempotently creates the account if none exists for your `(owner, externalAccountId)`, or updates the existing one, from the snapshot in the request body. Re-sending the same `externalAccountId` updates the same account. On create, Slate assigns and returns the account's `accountId`. Send the account's *current* full state; this is the primary way a daily inventory feed keeps Slate in sync.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpsertAccountRequest"}}}},"responses":{"200":{"description":"An existing account was updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"201":{"description":"A new account was created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"500":{"$ref":"#/components/responses/ServerError"}}}},"/v1/accounts/{accountId}":{"parameters":[{"$ref":"#/components/parameters/AccountId"}],"get":{"operationId":"getAccount","summary":"Get an account","description":"Returns the full account aggregate — identity, status, balance, current placement, and any legal record — by its Slate `accountId`.","responses":{"200":{"description":"The account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}},"patch":{"operationId":"patchAccount","summary":"Update an account","description":"Partially updates the account — send only the fields that changed, e.g. `{\"currentBalance\": 192.68}` or `{\"status\": \"CLOSED\"}`. Omitted fields are left unchanged. This is the single endpoint for targeted updates (balance, status, placement, legal, and other mutable fields); identity fields cannot be changed here.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountPatch"}}}},"responses":{"200":{"description":"The updated account.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"500":{"$ref":"#/components/responses/ServerError"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Owner-scoped bearer token. The `owner` all requests are scoped to is derived from the token."}},"parameters":{"AccountId":{"name":"accountId","in":"path","required":true,"description":"Slate's UUID for the account (returned by the upsert). The canonical account identifier.","schema":{"type":"string","format":"uuid"}},"Owner":{"name":"owner","in":"query","required":false,"description":"The owner (organization) to scope the request to. Optional — defaults to the owner on the bearer token; only multi-owner service credentials need to set it.","schema":{"type":"string"}}},"responses":{"BadRequest":{"description":"The request was malformed or failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing, invalid, or insufficiently scoped credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"No such account for this owner.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Conflict":{"description":"The request conflicts with the account's current state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"ServerError":{"description":"Unexpected internal error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"AccountStatus":{"type":"string","description":"Account lifecycle status. Binary: `ACTIVE` (being serviced) or `CLOSED` (resolved, returned, or otherwise done).","enum":["ACTIVE","CLOSED"]},"Account":{"type":"object","description":"The full account aggregate as Slate holds it.","required":["accountId","owner","externalAccountId","creditor","status","currentBalance"],"properties":{"accountId":{"type":"string","format":"uuid","readOnly":true,"description":"Slate's stable UUID for the account — the canonical identifier, assigned by Slate on create."},"owner":{"type":"string","description":"The organization that owns this account in Slate (your owner code)."},"externalAccountId":{"type":"string","description":"Your identifier for the account (the account number in your system) — the natural key the upsert matches on, unique within your owner."},"matterId":{"type":"string","format":"uuid","readOnly":true,"description":"Slate's internal matter UUID the account belongs to. Exposed for support/cross-referencing; today one account maps to one matter."},"accountNumber":{"type":"string","description":"The current client/account number. May change over the life of the account (e.g. when paper is sold)."},"originalAccountNumber":{"type":"string","description":"The originating account number, stable for the life of the debt. Used as the durable reference across ownership changes."},"creditor":{"type":"string","description":"The current owner of the debt (creditor code) this account belongs to."},"portfolioId":{"type":"string","nullable":true,"description":"Portfolio identifier, when the account is part of a purchased portfolio. Absent for forwarded/placed paper."},"status":{"$ref":"#/components/schemas/AccountStatus"},"closedOn":{"type":"string","format":"date","nullable":true,"description":"The date the account was closed; null while `ACTIVE`."},"currentBalance":{"type":"number","format":"double","description":"The current amount owed, in US dollars (two decimals)."},"chargeOffDate":{"type":"string","format":"date","nullable":true,"description":"The date the account was charged off, if applicable."},"placement":{"$ref":"#/components/schemas/Placement"},"legal":{"$ref":"#/components/schemas/LegalRecord"},"createdOn":{"type":"string","format":"date-time","readOnly":true,"description":"When Slate first created the account."},"lastUpdated":{"type":"string","format":"date-time","readOnly":true,"description":"When the account was last updated in Slate."}}},"UpsertAccountRequest":{"type":"object","description":"A full snapshot of the account's current state. Matched to an existing account on `(owner, externalAccountId)`; fields omitted are treated as unset/unchanged-to-empty, so send everything you know each time.","required":["externalAccountId","creditor","status","currentBalance"],"properties":{"externalAccountId":{"type":"string","description":"Your identifier for the account — the upsert key within your owner."},"creditor":{"type":"string","description":"The creditor that currently owns the debt."},"status":{"$ref":"#/components/schemas/AccountStatus"},"currentBalance":{"type":"number","format":"double","description":"The current amount owed, in US dollars (two decimals)."},"accountNumber":{"type":"string","description":"The current client/account number."},"originalAccountNumber":{"type":"string","description":"The stable originating account number."},"portfolioId":{"type":"string","description":"Portfolio identifier, if part of a purchased portfolio."},"chargeOffDate":{"type":"string","format":"date","description":"The charge-off date, if applicable."},"placement":{"$ref":"#/components/schemas/PlacementRequest"},"legal":{"$ref":"#/components/schemas/LegalRecord"}}},"AccountPatch":{"type":"object","description":"A partial account update: include only the fields you want to change. Omitted fields are left unchanged. Identity fields (`accountId`, `owner`, `externalAccountId`) cannot be changed here.","properties":{"status":{"$ref":"#/components/schemas/AccountStatus"},"currentBalance":{"type":"number","format":"double","description":"The current amount owed, in US dollars (two decimals)."},"chargeOffDate":{"type":"string","format":"date","description":"The charge-off date, if applicable."},"creditor":{"type":"string","description":"The creditor that currently owns the debt."},"accountNumber":{"type":"string","description":"The current client/account number."},"originalAccountNumber":{"type":"string","description":"The stable originating account number."},"portfolioId":{"type":"string","description":"Portfolio identifier, if part of a purchased portfolio."},"placement":{"$ref":"#/components/schemas/PlacementRequest"},"legal":{"$ref":"#/components/schemas/LegalRecord"}}},"Placement":{"type":"object","nullable":true,"description":"The servicing firm the account is currently placed with, and its fee terms. Null when the account is not placed.","properties":{"serviceFirm":{"type":"string","description":"The firm/agency currently handling the account."},"placementDate":{"type":"string","format":"date","description":"When the account was placed with this firm."},"feeStructure":{"type":"string","description":"The fee arrangement for the placement (e.g. contingency)."},"feeRateType":{"type":"string","description":"How the fee rate is expressed."},"placementBalance":{"type":"number","format":"double","description":"The balance at the time of placement, in US dollars."}}},"PlacementRequest":{"type":"object","required":["serviceFirm"],"properties":{"serviceFirm":{"type":"string","description":"The firm/agency to place the account with."},"placementDate":{"type":"string","format":"date","description":"When the account was placed. Defaults to today."},"feeStructure":{"type":"string","description":"The fee arrangement for the placement."},"feeRateType":{"type":"string","description":"How the fee rate is expressed."},"placementBalance":{"type":"number","format":"double","description":"The balance at the time of placement, in US dollars."}}},"LegalRecord":{"type":"object","nullable":true,"description":"The account's legal activity. A suit and/or a judgment; either may be absent.","properties":{"suit":{"$ref":"#/components/schemas/Suit"},"judgment":{"$ref":"#/components/schemas/Judgment"}}},"Suit":{"type":"object","description":"A filed lawsuit on the account.","required":["filedDate"],"properties":{"filedDate":{"type":"string","format":"date","description":"The date the suit was filed. Its presence is what records the suit."}}},"Judgment":{"type":"object","description":"A judgment entered on the account.","required":["enteredDate"],"properties":{"enteredDate":{"type":"string","format":"date","description":"The date judgment was entered. Its presence is what records the judgment."},"amount":{"type":"number","format":"double","description":"The total judgment amount, in US dollars (two decimals)."}}},"Error":{"type":"object","required":["message"],"properties":{"message":{"type":"string","description":"A human-readable description of what went wrong."}}}}}}