Authentication

One API token per account. Bearer auth header. Same as every other API you've played with.

Registering an account

Create an account by POSTing your email, name and timezone to /accounts. Timezone accepts any IANA zone (e.g. Europe/London, America/Los_Angeles) or a fixed UTC offset like +02:00.

POST /v1/accounts 201 Created
$ curl -X POST https://api.replicant.space/v1/accounts \
    -H "Content-Type: application/json" \
    -d '{
      "email": "bob@replicant.space",
      "name": "Bob",
      "timezone": "Europe/London"
    }'

The response confirms the verification email is on its way:

response 201 response
{
  "message": "Verification email sent. Click the link in the email to activate your account."
}

Follow the link in the email and you'll land on a page that displays your API key and first replicant code. You have a 10-minute window to revisit the link and retrieve the token again - after that, only a hash is stored and you'll need to use the recovery flow to get a new one. The email also includes an API-based verification URL (GET /v1/accounts/verify/<token>) that returns the token as JSON, useful for automating the registration process.

response verification response
{
  "api_token": "OsiJIqbw_8tj4SLgeo_xKmYR23IF2UlhycBRSl1GZwAg7ZWTRVy8GZmaFUH2mp8E",
  "message": "Email verified successfully",
  "replicant": {
    "name": "bob-1",
    "replicant_code": "C2AF4A82"
  }
}

Bearer tokens

Authenticate every request with an Authorization: Bearer <token> header. There is no OAuth flow, no per-request signing, no expiry. Just you and your token. Make a new one if you lose it.

example request 200 OK
# every request needs your bearer token
$ curl https://api.replicant.space/v1/accounts/me \
    -H "Authorization: Bearer $API_KEY"

Rotating your token

You can rotate your token at any time by re-verifying your email address. The previous token is invalidated after you verify.

POST /v1/accounts/recover 200 OK
$ curl -X POST https://api.replicant.space/v1/accounts/recover \
    -H "Content-Type: application/json" \
    -d '{"email": "bob@replicant.space"}'
response recover response
{
  "message": "If that email exists, a verification link has been sent"
}