Skip to content

Authentication ​

3 operations. Paths are relative to https://api.frege.io.

Email a one-time sign-in code ​

POST/v1/auth/magic

Sends a six-digit code to the address, creating the account on first use. The SPA collects the code and posts it to /auth/magic/verify — sign-in stays entirely in Frege's own UI.

Authentication: none.

Request body (application/json)

Schema: api.magicRequest.

FieldTypeDescription
emailstring

Responses

StatusDescriptionBody
204No Content
422Unprocessable Entityerror envelope
502Bad Gatewayerror envelope

Exchange a one-time code for a session ​

POST/v1/auth/magic/verify

Verifies the emailed six-digit code, provisioning (or linking) the Frege user on first sign-in. Returns the session, whose token is the API's bearer token and whose refresh_token renews it through /auth/refresh.

Authentication: none.

Request body (application/json)

Schema: api.magicVerifyRequest.

FieldTypeDescription
codestring
emailstring

Responses

StatusDescriptionBody
200OKdata
401Unauthorizederror envelope
422Unprocessable Entityerror envelope

Exchange a refresh token for a fresh session ​

POST/v1/auth/refresh

Trades a still-valid refresh token for a new access token (and rotated refresh token) without another interactive sign-in. Call this when the access token is near or past expiry.

Authentication: none.

Request body (application/json)

Schema: api.refreshRequest.

FieldTypeDescription
refresh_tokenstring

Responses

StatusDescriptionBody
200OKdata
401Unauthorizederror envelope
422Unprocessable Entityerror envelope