# Quickstart

> Make a first call with no sign-in, then sign in with an email code and make an authenticated call.

URL: https://renzo-digital.com/docs/quickstart

This takes about five minutes. You need `curl`, Python 3 with `requests`, or Node.js 18 or later. You also need an email inbox you can read.

The examples use the UAT (test) server:

```bash
export BASE=https://api.uat.renzo-digital.com
```

## 1. Make a call with no sign-in

Public reads need no token. List the three newest articles:

```bash tab="curl"
curl "$BASE/api/v1/articles?limit=3"
```

```python tab="Python"
import requests

BASE = "https://api.uat.renzo-digital.com"

answer = requests.get(f"{BASE}/api/v1/articles", params={"limit": 3})
answer.raise_for_status()
for article in answer.json()["items"]:
    print(article["published_at"], article["title"])
```

```js tab="Node.js"
const BASE = "https://api.uat.renzo-digital.com";

const answer = await fetch(`${BASE}/api/v1/articles?limit=3`);
if (!answer.ok) throw new Error(`HTTP ${answer.status}`);
const page = await answer.json();
for (const article of page.items) console.log(article.published_at, article.title);
```

The answer is `200` with a page of articles. List rows never carry the article body:

```json title="Response"
{
  "items": [
    {
      "id": "f43679d3-0ab5-5f68-8bda-f0a4c5560594",
      "slug": "fed-holds-rates-steady-as-inflation-cools",
      "title": "Fed holds rates steady as inflation cools",
      "type": "news",
      "access_level": "public",
      "locale": "en",
      "requested_locale": "en",
      "published_at": "2026-11-04T13:30:00Z",
      "symbols": [
        { "ticker": "US500", "slug": "us500-index", "asset_class": "index" }
      ]
    }
  ],
  "has_more": true,
  "next_cursor": "eyJrIjoiMjAyNi0xMS0wNFQxMzozMDowMFoifQ",
  "limit": 3
}
```

The JSON above is trimmed. To get the next page, send `next_cursor` back as `cursor`. See [Pagination](https://renzo-digital.com/docs/concepts/pagination).

## 2. Ask for a sign-in code

Send your email address. The answer is `202`, and it is the same whether or not the address has an account.

```bash tab="curl"
curl -X POST "$BASE/api/v1/auth/otp/request" \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'
```

```python tab="Python"
answer = requests.post(f"{BASE}/api/v1/auth/otp/request", json={"email": "you@example.com"})
answer.raise_for_status()
challenge_token = answer.json()["challenge_token"]
```

```js tab="Node.js"
const requested = await fetch(`${BASE}/api/v1/auth/otp/request`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email: "you@example.com" }),
});
const { challenge_token } = await requested.json();
```

```json title="Response"
{
  "challenge_token": "ch_7Hq2mXz9Kp4TnV1b",
  "expires_at": "2026-11-04T13:40:00Z",
  "code_expires_at": "2026-11-04T13:35:00Z",
  "attempts_remaining": 5
}
```

An email arrives with a six-digit code. The code works for 10 minutes. Keep the `challenge_token`.

## 3. Trade the code for tokens

```bash tab="curl"
curl -X POST "$BASE/api/v1/auth/otp/verify" \
  -H "Content-Type: application/json" \
  -d '{"challenge_token": "ch_7Hq2mXz9Kp4TnV1b", "code": "482913"}'
```

```python tab="Python"
code = input("Code from the email: ")
answer = requests.post(
    f"{BASE}/api/v1/auth/otp/verify",
    json={"challenge_token": challenge_token, "code": code},
)
answer.raise_for_status()
tokens = answer.json()["tokens"]
```

```js tab="Node.js"
const code = "482913"; // the code from the email
const verified = await fetch(`${BASE}/api/v1/auth/otp/verify`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ challenge_token, code }),
});
const { tokens } = await verified.json();
```

The answer is `200`:

```json title="Response"
{
  "tokens": {
    "access_token": "eyJhbGciOiJIUzI1NiIs...example",
    "refresh_token": "eyJhbGciOiJIUzI1NiIs...refresh-example",
    "token_type": "Bearer",
    "expires_in": 900,
    "expires_at": "2026-11-04T13:45:00Z",
    "refresh_expires_at": "2026-12-04T13:30:00Z"
  },
  "profile": {
    "id": "eca8506d-1dfa-56a2-8765-96305e99f89c",
    "email": "you@example.com",
    "username": null,
    "status": "pending_profile",
    "country": null,
    "ui_language": "en",
    "article_language": "en",
    "timezone": "UTC",
    "currency": "USD",
    "mobile": null,
    "created_at": "2026-11-04T13:30:00Z",
    "last_login_at": "2026-11-04T13:30:00Z"
  },
  "created": true
}
```

`created` is `true` on the first sign-in: the account was just made. The access token lives 15 minutes. The refresh token renews it, see [Authentication](https://renzo-digital.com/docs/authentication#refresh-the-token-pair).

A wrong code answers `401` [`otp_code_incorrect`](https://renzo-digital.com/docs/error-codes#otp_code_incorrect). After 5 wrong codes, the challenge answers [`otp_too_many_attempts`](https://renzo-digital.com/docs/error-codes#otp_too_many_attempts): ask for a new code.

## 4. Make an authenticated call

Send the access token in the `Authorization` header:

```bash tab="curl"
export TOKEN=eyJhbGciOiJIUzI1NiIs...example
curl "$BASE/api/v1/users/me" -H "Authorization: Bearer $TOKEN"
```

```python tab="Python"
headers = {"Authorization": f"Bearer {tokens['access_token']}"}
answer = requests.get(f"{BASE}/api/v1/users/me", headers=headers)
answer.raise_for_status()
print(answer.json())
```

```js tab="Node.js"
const headers = { Authorization: `Bearer ${tokens.access_token}` };
const me = await fetch(`${BASE}/api/v1/users/me`, { headers });
console.log(await me.json());
```

```json title="Response"
{
  "id": "eca8506d-1dfa-56a2-8765-96305e99f89c",
  "email": "you@example.com",
  "username": null,
  "status": "pending_profile",
  "ui_language": "en",
  "article_language": "en",
  "timezone": "UTC",
  "currency": "USD",
  "country": null,
  "mobile": null,
  "created_at": "2026-11-04T13:30:00Z",
  "last_login_at": "2026-11-04T13:30:00Z"
}
```

## 5. Finish the profile

A new account has status `pending_profile`. It can read, but most writes answer `409` [`profile_incomplete`](https://renzo-digital.com/docs/error-codes#profile_incomplete) until it has a username. Set one:

```bash tab="curl"
curl -X PATCH "$BASE/api/v1/users/me" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"username": "marketwatcher"}'
```

```python tab="Python"
answer = requests.patch(f"{BASE}/api/v1/users/me", headers=headers, json={"username": "marketwatcher"})
answer.raise_for_status()
```

```js tab="Node.js"
await fetch(`${BASE}/api/v1/users/me`, {
  method: "PATCH",
  headers: { ...headers, "Content-Type": "application/json" },
  body: JSON.stringify({ username: "marketwatcher" }),
});
```

The answer is `200` with the profile, now with `"status": "active"`. A name someone else holds answers `409` [`username_taken`](https://renzo-digital.com/docs/error-codes#username_taken).

## Next steps

- [Authentication](https://renzo-digital.com/docs/authentication): refresh, sign-out, social sign-in and every auth error.
- [Errors](https://renzo-digital.com/docs/concepts/errors): how to read an error and what to retry.
- [Watchlists](https://renzo-digital.com/docs/resources/watchlists) and [Price alerts](https://renzo-digital.com/docs/resources/price-alerts): the main personal features.
- [API reference](https://renzo-digital.com/docs/api): every operation, with code samples.
