Rendra Docs / Autenticazione

Autenticazione

Rendra usa le chiavi API per l'autenticazione. Ogni richiesta a un endpoint protetto deve includere un token Bearer valido.

Ottenere una chiave API

API keys are created when you register an account. Send a POST request to /api/v1/users with your email address:

curl -X POST https://rendra.alphabros.eu/api/v1/users \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

Response:

{
  "id": "usr_abc123",
  "email": "you@example.com",
  "api_key": "rnd_live_xxxxxxxxxxxxxxxxxxxx",
  "plan": "free"
}
Important: Your api_key is shown only once at creation time. Store it securely — you cannot retrieve it again. If you lose it, you will need to contact support to rotate it.

Usare la tua chiave API

Pass your API key as a Bearer token in the Authorization header on every request:

Authorization: Bearer YOUR_API_KEY

Example — curl

curl -X POST https://rendra.alphabros.eu/api/v1/generate \
  -H "Authorization: Bearer rnd_live_xxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A clean product launch banner", "width": 1200, "height": 630}'

Example — JavaScript (fetch)

const response = await fetch('https://rendra.alphabros.eu/api/v1/generate', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.RENDRA_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    prompt: 'A clean product launch banner',
    width: 1200,
    height: 630,
  }),
});

Errori di autenticazione

Stato Code Description
401 Unauthorized Missing or malformed Authorization header.
403 Forbidden API key is invalid or has been revoked.
429 Too Many Requests You have exceeded your plan's rate limit. See Fatturazione e utilizzo.

Migliori pratiche di sicurezza

Non esporre mai la tua chiave API lato client

Chiama sempre l'API di Rendra dal tuo server o da una funzione serverless. Non incorporare mai la tua chiave nel JavaScript del browser o nei binari delle app mobili.

Usa le variabili d'ambiente

Store your key in an environment variable (RENDRA_API_KEY) and load it at runtime. Never hardcode it in source files or commit it to version control.

Ruota le chiavi in caso di compromissione

If you suspect your key has been leaked, contact support@alphabros.eu immediately to have it rotated.

Next step: Now that you're authenticated, explore the Riferimento API or jump straight to the Guida all'SDK.