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:

DocumentShape
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, not prev.
  • An error's status is an integer, not a string.
  • An error's source is 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.

Authentication

The uscca-cloud gateway verifies these credentials before a request reaches this API. Send them as HTTP headers.

CredentialHeaderWho sends it
Member sessionX-AUTH-TOKENAn app calling for a signed-in member, with that member's session token (JWT). A browser app sends only this.
API tokenX-Api-TokenA 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.

Common headers

HeaderInRequiredValue
AcceptRequestNoIf 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-TypeRequestWith a bodyapplication/json, optionally with charset=utf-8. Otherwise 415. An action that takes no body skips this check.
traceparentBothNoW3C Trace Context. A valid one continues your trace; every response this API sends carries this request's.
X-Request-IdBothNoEvery response this API sends carries the id it gave the request: quote it when reporting a problem. One you send is never echoed back.
LocationResponseOn a 201The path of the created resource.
Cache-ControlResponseAlwaysno-store

Common query parameters

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.

ParameterOnValue
page[number]CollectionsThe page to return, 1 to 1000. Default 1.
page[size]CollectionsRows per page, 1 to 100. Default 25.
sortCollections that list sort fieldsComma-separated fields, each ascending or, with a leading -, descending: -createdAt,name.
filter[<field>]Collections that list that filterOnly the rows whose field has that value.

Common error responses

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"
    }
  ]
}
StatustitleWhen
400Invalid RequestA query parameter is unknown, malformed or out of range.
401UnauthorizedA credential is missing or invalid, or the calling application is not recognized.
403ForbiddenThe caller may not make this call.
404Not FoundNo such resource, or no such route.
406Invalid RequestAccept cannot be satisfied (see Common headers).
415Invalid RequestThe body's Content-Type is not application/json.
422Validation ErrorThe 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.
500Internal ErrorAn unexpected failure. Quote the response's X-Request-Id.
503Upstream UnavailableA 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.

Servers
Development
https://memberships.dev.uscca.cloud
Staging
https://memberships.staging.uscca.cloud
Production
https://memberships.uscca.cloud