Authentication · FAQ
How do I authenticate with the Casafari REST API?
Authenticate with the Casafari REST API by sending your email and password as JSON to POST https://api.casafari.com/login. It returns a JWT access token and a refresh token; the API doesn't use OAuth.
- Send
{ "email": …, "password": … }toPOST /login. It responds200withaccess_tokenandrefresh_token. - Include
Authorization: Bearer <access_token>when you call any operation. - To get a new
access_token, callGET /refresh-tokenwith the refresh token as the bearer.
A 401 from either endpoint means the credentials are wrong or the refresh token has expired, so log in again. A 422 from /login means the body is malformed, so send email and password as JSON. After you sign in, https://docs.api.casafari.com/ shows which operations your account may call.
See: REST API and REST authentication.