Memberships API (0.1.0)
Memberships as multi-seat plans. Every request reaches this API through the uscca-cloud gateway.
Responses are JSON:API 1.1 documents, served as application/vnd.api+json:
| Document | Shape |
|---|---|
| A single resource | { data } |
| A collection | { links, data, meta }. links holds self, first, previous, next and last; meta holds the page counts total, count, perPage, currentPage and totalPages. |
| An error | { errors }, described under Common error responses |
Three departures from JSON:API:
- A collection's previous-page link is
previous, notprev. - An error's
statusis an integer, not a string. - An error's
sourceis the field or parameter name as a plain string (dot notation when nested), not an object.
Write requests (POST, PATCH) send a flat JSON object of attributes as application/json, not a JSON:API document. PATCH takes the id from the URL and POST creates it, so a body carrying id, type or data is a 422, like any other unknown key. An action such as POST /v1/plan-types/{id}/retire takes no body.
The uscca-cloud gateway verifies these credentials before a request reaches this API. Send them as HTTP headers.
| Credential | Header | Who sends it |
|---|---|---|
| Member session | X-AUTH-TOKEN | An app calling for a signed-in member, with that member's session token (JWT). A browser app sends only this. |
| API token | X-Api-Token | A server-side application, such as an agent tool or a job. Never send it from a browser. |
A server-side application acting for a member sends both. What a call may do depends on who makes it: a member acting for themselves, or an application with its own permissions. A call the caller may not make answers 403. A missing or invalid credential, or an application this API does not recognize, answers 401.
Not yet enabled: on the servers listed here, a call that carries an API token, alone or with a member session token, answers 401 until application calls are turned on.
| Header | In | Required | Value |
|---|---|---|---|
Accept | Request | No | If it lists application/vnd.api+json and neither */* nor application/*, at least one of those entries must carry no parameter but a q weight (this API supports no ext or profile), or the answer is 406. Any other Accept is not checked. |
Content-Type | Request | With a body | application/json, optionally with charset=utf-8. Otherwise 415. An action that takes no body skips this check. |
traceparent | Both | No | W3C Trace Context. A valid one continues your trace; every response this API sends carries this request's. |
X-Request-Id | Both | No | Every response this API sends carries the id it gave the request: quote it when reporting a problem. One you send is never echoed back. |
Location | Response | On a 201 | The path of the created resource. |
Cache-Control | Response | Always | no-store |
Every operation in this document except liveness (GET /health) answers 400 to a query parameter it does not list, with source naming it. include and fields[...] are not supported.
| Parameter | On | Value |
|---|---|---|
page[number] | Collections | The page to return, 1 to 1000. Default 1. |
page[size] | Collections | Rows per page, 1 to 100. Default 25. |
sort | Collections that list sort fields | Comma-separated fields, each ascending or, with a leading -, descending: -createdAt,name. |
filter[<field>] | Collections that list that filter | Only the rows whose field has that value. |
An error answers with an error document, one entry per problem. source is absent when the problem is with the request as a whole.
{
"errors": [
{
"status": 422,
"title": "Validation Error",
"source": "seatCap",
"detail": "Too small: expected number to be >=1"
}
]
}
| Status | title | When |
|---|---|---|
| 400 | Invalid Request | A query parameter is unknown, malformed or out of range. |
| 401 | Unauthorized | A credential is missing or invalid, or the calling application is not recognized. |
| 403 | Forbidden | The caller may not make this call. |
| 404 | Not Found | No such resource, or no such route. |
| 406 | Invalid Request | Accept cannot be satisfied (see Common headers). |
| 415 | Invalid Request | The body's Content-Type is not application/json. |
| 422 | Validation Error | The body or a path parameter is invalid, a malformed id included, or the resource's state does not allow the change, such as editing a retired plan type. |
| 500 | Internal Error | An unexpected failure. Quote the response's X-Request-Id. |
| 503 | Upstream Unavailable | A service this API depends on failed, timed out or gave an unusable answer. |
Each operation lists the statuses it can return. The gateway can answer 401 before a request reaches this API; its error carries its text in message rather than detail.