Skip to content
Last updated

Authentication

Every endpoint except login requires a Bearer token in the Authorization header.

Get a token

Use POST /v1/auth/login with your Franklin credentials in the body. The account must have API access enabled for your organization.

curl -X POST "https://api.genoox.com/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "password": "your_password"}'
{
  "token": "eyJhbGciOiJIUzI1NiIs...",
  "duration": 86400,
  "expires_at": 1704153600
}
FieldMeaning
tokenSend as Authorization: Bearer <token>
durationValidity in seconds, typically 86400 (24 hours)
expires_atUnix timestamp, in seconds, when the token stops working

A GET variant also exists, taking the email as a query parameter and the password in the Authorization header. Prefer POST for new integrations: it keeps the email out of URLs and access logs.

Use the token

curl "https://api.genoox.com/v1/analysis?analysis_id=12345" \
  -H "Authorization: Bearer $FRANKLIN_TOKEN"

Keep a session alive

Tokens expire; there is no refresh endpoint. Log in again shortly before expires_at, and once more if a call returns 401.

import time
import requests

BASE = "https://api.genoox.com"

class FranklinClient:
    def __init__(self, email, password):
        self.email, self.password = email, password
        self.token, self.expires_at = None, 0

    def _login(self):
        r = requests.post(f"{BASE}/v1/auth/login",
                          json={"email": self.email, "password": self.password})
        r.raise_for_status()
        body = r.json()
        self.token, self.expires_at = body["token"], body["expires_at"]

    def request(self, method, path, **kwargs):
        if time.time() > self.expires_at - 300:          # renew 5 minutes early
            self._login()
        headers = {"Authorization": f"Bearer {self.token}"}
        r = requests.request(method, f"{BASE}{path}", headers=headers, **kwargs)
        if r.status_code == 401:                          # revoked or expired early
            self._login()
            headers["Authorization"] = f"Bearer {self.token}"
            r = requests.request(method, f"{BASE}{path}", headers=headers, **kwargs)
        return r

The recipes use this FranklinClient as client.

Login failures

StatusmessageWhat to do
401login failed, check email and passwordCheck the credentials
401user you@example.com is not allowed to use apiAsk your Franklin representative to enable API access for this user
429rate limit exceededBack off. Repeated failed logins can temporarily block the account

Good practice

  • Use a dedicated integration user rather than a person's account, so rotating the password or offboarding someone never breaks the integration.
  • Keep credentials in a secret store, never in source code.
  • Reuse one token for its lifetime instead of logging in before every call.