API¶
The API is described in OpenAPI 3.1: api/openapi.yaml.
The contract test (internal/api/contract_test.go) calls every documented
operation, success and error paths, and validates each real response
against the file; an operation the test never calls fails it.
Listeners¶
Listener |
Default |
TLS |
Auth |
|---|---|---|---|
public |
|
server certificate |
|
device |
|
server certificate, client certificate requested |
enrollment token, or the device certificate for renewal; |
internal |
off; |
server certificate, client certificate required (service CA) |
CN |
admin |
|
none |
none: |
Conventions¶
Errors are RFC 9457
application/problem+jsonwithtype,title,status,detail,instance(the request ID) and a stablecode. Internal error messages never reach the client; the request ID finds them in the server log.Paging: lists return
itemsandnext_cursor. Cursors are opaque, HMAC-signed and bound to the endpoint, the tenant and the query. Follownext_cursoruntil it is absent; the last page never comes back empty. A readings page is the exception: each request decrypts a bounded number of chunks, so a page can hold fewer readings thanlimit, or none, and still carrynext_cursor. A readings query that runs past the server’s deadline gets503with codetimeout.Rate limits: per token (default 20 requests/s, burst 40), and per client network (IPv4 address or IPv6 /64) for failed token lookups (default 5/s, burst 50), per replica. Over a limit:
429withRetry-After. Both are checked before the token is looked up, and the token’s limit before its scopes, so a429can come where a401or403would otherwise be the answer. On the device listener, enrollment andGET /v1/crleach have a per-network limit and renewal a per-device one (default 50/s, burst 200).Request bodies: JSON, at most 1 MiB, unknown fields rejected.
Scopes¶
Scope |
Allows |
|---|---|
|
list and show devices, device purge jobs |
|
revoke and delete devices, create enrollment tokens |
|
readings and gaps |
|
export status, download and export jobs / create exports |
|
the tenant’s audit log |
|
the tenant’s settings and API tokens, retention and tenant destroy jobs |
Jobs¶
Deleting a device or a tenant, exports and retention run as background
jobs. DELETE /v1/devices/{id} and DELETE /v1/admin/tenants/{id} answer
202 with the job_id doing the work: a new job, or the one already
queued, running or done for the same device or tenant. A job that failed
for good does not block a new request. GET /v1/jobs/{id} needs the read
scope of what the job works on (see above), and its last_error is a
fixed message; the real error is in the server log under the job ID.
The API deletes finished jobs 30 days after they finish, and GET then
answers 404. It deletes enrollment tokens 7 days after they expire,
used or not.
Exports¶
A tenant can have 4 exports pending or running at once
(FLEETWIRE_API_MAX_ACTIVE_EXPORTS); another POST /v1/exports gets 409
with code too_many_exports. A download past the export’s expires_at
gets 410 with code expired. HEAD on the download sends the status and
headers, Content-Digest included, without the file. The API deletes an
export 30 days after its expires_at, or 30 days after its created_at
if it failed; GET /v1/exports/{id} and the download then answer 404.