Quickstart
Register a Lunar API account, capture a bearer token, and call your first authenticated endpoint.
Quickstart
This walkthrough takes you from zero to an authenticated request. All you need is curl.
- Register an account
Send a username and password to
POST /auth/register. You get back auserobject and anaccessToken. - Save the access token
The response includes
accessTokenwith theBearerprefix already attached. Use it verbatim as yourAuthorizationheader.capture the token TOKEN=$(curl -s -X POST https://api.lunargroup.dev/auth/register \ -H 'Content-Type: application/json' \ -d '{"username":"winter_fe","password":"correct horse battery staple"}' \ | jq -r .accessToken) - Call an authenticated route
Pass the token straight through as the
Authorizationheader. Here we fetch a random fox.random fox curl -s https://api.lunargroup.dev/images/fox/random \ -H "Authorization: $TOKEN" - Refresh your token when needed
Logging in again rotates the token and invalidates the old one. Call
POST /auth/loginwith the same credentials to get a freshaccessToken.