---
title: "Get countdown"
description: "Read the countdown timer settings of a preorder offer."
url: https://docs.stoqapp.com/v2-reference/preorders-offers/get-countdown/
api: "API v2 reference"
method: GET
path: "/preorders/offers/{id}/countdown"
---

# Get countdown

`GET https://app.stoqapp.com/api/v2/external/preorders/offers/{id}/countdown`

Read the countdown timer settings of a preorder offer.

**Note:** `show_when` is worked out from the timer's dates, not stored. With `date_source` `schedule` the timer counts to the offer's schedule and the top-level `starts_at` and `ends_at` (the custom dates) are unused; `current.starts_at` and `current.ends_at` are always the dates it counts to. `current` is what shoppers see now: `visible_phase` `hidden`, `before_launch` or `during_preorder`, with `target_at` and `heading_text`. The timer is hidden while the offer is off. Edit with [`PATCH /preorders/offers/:id/countdown`](https://docs.stoqapp.com/v2-reference/preorders-offers/update-countdown/).

## Path parameters

- `id` (string, required): The offer's ID, from [`GET /preorders/offers`](https://docs.stoqapp.com/v2-reference/preorders-offers/list-offers/).

## Query parameters

- `locale` (string): Language for translated text, such as fr or pt-BR. Omit for the shop's default language.

## Returns

- `show_when` (string): disabled hides the timer; before_launch counts down to the start, during_preorder to the end, both to the start and then the end. One of: `disabled`, `before_launch`, `during_preorder`, `both`.
- `date_source` (string): schedule counts to the offer's schedule dates; custom to starts_at and ends_at. One of: `schedule`, `custom`.
- `starts_at` (null): Custom launch date, ISO 8601 in UTC. Used when date_source is custom; null when not set.
- `ends_at` (null): Custom deadline, ISO 8601 in UTC. Used when date_source is custom; null when not set.
- `starts_text` (null): Heading shown before launch. Null when not set.
- `ends_text` (null): Heading shown during the preorder. Null when not set.
- `labels` (object): Unit labels shown on the timer.
  - `days` (string): Days label.
  - `hours` (string): Hours label.
  - `minutes` (string): Minutes label.
  - `seconds` (string): Seconds label.
- `text_color` (string): Timer text color, as hex.
- `background_color` (string): Timer background color, as hex.
- `border_radius` (integer): Timer corner radius in pixels.
- `units` (array of strings): Time units the timer shows, any of days, hours, minutes and seconds.
- `current` (object): What the timer shows right now, worked out from the settings, the dates and the offer's status. Read-only.
  - `visible_phase` (string): hidden when no timer shows now; before_launch while counting to the start; during_preorder while counting to the end. One of: `hidden`, `before_launch`, `during_preorder`.
  - `target_at` (null): The moment the timer counts down to now, ISO 8601 in UTC. Null when hidden.
  - `heading_text` (null): Heading shown above the timer now. Null when hidden or not set.
  - `starts_at` (null): Start date the timer uses, from the schedule or the custom dates per date_source, ISO 8601 in UTC. Null when none.
  - `ends_at` (null): End date the timer uses, from the schedule or the custom dates per date_source, ISO 8601 in UTC. Null when none.

Rate limit: this call costs 1 point ([rate limits](https://docs.stoqapp.com/docs/rate-limits/)).

## Examples

### Get countdown

```sh
curl "https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/countdown" \
  -H "X-Auth-Token: $STOQ_API_KEY"
```

### Get countdown filtered by locale

```sh
curl "https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/countdown?locale=fr" \
  -H "X-Auth-Token: $STOQ_API_KEY"
```

## 200

Success: the requested resource.

```json
{
  "show_when": "disabled",
  "date_source": "schedule",
  "starts_at": null,
  "ends_at": null,
  "starts_text": null,
  "ends_text": null,
  "labels": {
    "days": "string",
    "hours": "string",
    "minutes": "string",
    "seconds": "string"
  },
  "text_color": "string",
  "background_color": "string",
  "border_radius": 1,
  "units": [
    "string"
  ],
  "current": {
    "visible_phase": "hidden",
    "target_at": null,
    "heading_text": null,
    "starts_at": null,
    "ends_at": null
  }
}
```

## 401

Missing or invalid `X-Auth-Token`.

```json
{
  "errors": [
    "Invalid API key"
  ],
  "code": "auth_invalid",
  "details": [
    {
      "code": "auth_invalid",
      "message": "Invalid API key",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 404

The resource does not exist for this shop, or the action path is not registered.

```json
{
  "errors": [
    "Offer not found"
  ],
  "code": "not_found",
  "details": [
    {
      "code": "not_found",
      "message": "Offer not found",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 422

The request failed validation.

```json
{
  "errors": [
    "name is required"
  ],
  "code": "validation_failed",
  "details": [
    {
      "code": "validation_failed",
      "message": "name is required",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

## 429

Rate limited: cost-weighted per token (read 1, write 2; 360 points / 60s). Check `Retry-After`.

```json
{
  "errors": [
    "Rate limit exceeded"
  ],
  "code": "rate_limited",
  "details": [
    {
      "code": "rate_limited",
      "message": "Rate limit exceeded",
      "path": null,
      "value": null,
      "expected": null
    }
  ]
}
```

