---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://truto.one/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Preview a code for the signed-in person

> Source: https://truto.one/docs/api-reference/admin/billing/get-offer-code/

`GET /billing/offer-code/{code}`

Resource: **Billing**

**What a code gives, whether it is valid, and which of the person's teams can redeem it.** For the redeem page (`/redeem/<CODE>`). Not tied to one team. Nothing is written. An invalid code is a `200` with `valid: false` and a `refusal`: `credit_code_invalid`, `code_expired` ("This link expired on 5 Jan 2027. Ask us for a new one."), `credit_code_expired`, `credit_code_used_up` or `credit_code_locked` (this link is for another email, compared without case).

## Path parameters

- **`code`** _(string, required)_

## Response body

- **`result`** _(object)_
  - **`code`** _(string)_
  - **`valid`** _(boolean)_
  - **`refusal`** _(object)_
    Why the code cannot be redeemed, as the redeem would answer. Null when it can.
    - **`truto_error_code`** _(string)_
    - **`message`** _(string)_
  - **`redeem_by`** _(string)_
    The last moment the link works. Null for no date.
  - **`offer`** _(object)_
    Null for an unknown code.
    - **`id`** _(string)_
    - **`key`** _(string)_
    - **`name`** _(string)_
    - **`lines`** _(array<string>)_
      What the offer gives. The staff-written `display_lines` when the offer has them.
    - **`summary`** _(object)_
      The same as `lines`, in groups for a page.
      - **`main`** _(array<string>)_
        The credits, discount and Pro lines; or the offer's staff-written `display_lines`.
      - **`included`** _(array<string>)_
        Feature and service names the team gets. For an offer about Pro, every Pro feature it keeps, then what the offer adds.
      - **`excluded`** _(array<string>)_
        Pro features this offer leaves out. Services left out are not listed.
    - **`ends_at`** _(string)_
      The sooner of the link's `redeem_by` and the offer's end.
    - **`credit_cents`** _(integer)_
    - **`credit_valid_days`** _(integer)_
    - **`pro_on`** _(boolean)_
    - **`pro_continue_ask`** _(boolean)_
  - **`redeemed_by`** _(object)_
    Set when the code was already redeemed. The team is named only when it is one of the person's own; otherwise its fields are null.
    - **`team_id`** _(string)_
    - **`team_name`** _(string)_
    - **`team_offer_id`** _(string)_
  - **`teams`** _(array<object>)_
    Each team the person is in.
    - **`id`** _(string)_
    - **`name`** _(string)_
    - **`logo`** _(string)_
      The team's logo URL, if it has one.
    - **`is_admin`** _(boolean)_
    - **`can_redeem`** _(boolean)_
    - **`refusal`** _(object)_
      Why the code cannot be redeemed, as the redeem would answer. Null when it can.
      - **`truto_error_code`** _(string)_
      - **`message`** _(string)_
    - **`replaces`** _(array<string>)_
      What changes for this team, in plain lines.
    - **`needs`** _(array<string>)_
      What the team still needs, in plain lines.

## Errors

| Status | Description |
| :----- | :---------- |
| `403` | Forbidden for anything but a signed-in session |

## Code examples

### curl

```bash
curl -X GET 'https://api.truto.one/billing/offer-code/{code}' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json'
```

### JavaScript

```javascript
const response = await fetch('https://api.truto.one/billing/offer-code/{code}', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/billing/offer-code/{code}"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}

response = requests.get(url, headers=headers, params=params)
print(response.json())
```
