# amo.versions

**stable** **Advanced**

Published versions of a Firefox add-on (AMO).

`GET /v1/amo/versions`

## What you get

A list of Amo results in Onekey's unified shape, in `data` (an array). An empty array is a normal, successful answer and is charged like any other; a source that reports "nothing found" as an error returns a free `404 not_found` instead.

## What it costs

- **Advanced · 5 credits** for a fresh fetch, charged only when it succeeds.
- **Free when served from cache (0.2 credit for a cached response over 100 KB).**
- **Free** if the request is invalid (never charged) or the source fails or reports not found (refunded).

## Parameters

| Name | Type | Required | Default | What it is | Constraints |
| --- | --- | --- | --- | --- | --- |
| `slug` | string | yes | (required) | Add-on slug or numeric id, e.g. ublock-origin | max 100 chars; must match `[A-Za-z0-9][A-Za-z0-9_.-]{0,99}`; trimmed |

## Request

```bash
curl "https://api.onekey.dev/v1/amo/versions?slug=ublock-origin" \
  -H "x-api-key: YOUR_API_KEY"
```

```python
import requests

res = requests.get(
    "https://api.onekey.dev/v1/amo/versions",
    params={"slug": "ublock-origin"},
    headers={"x-api-key": "YOUR_API_KEY"},
)
body = res.json()

if body["success"]:
    print(body["data"])
else:
    print(body["error"]["code"], body["error"]["message"])
```

```javascript
const params = new URLSearchParams({ slug: "ublock-origin" });
const res = await fetch(`https://api.onekey.dev/v1/amo/versions?${params}`, {
  headers: { "x-api-key": "YOUR_API_KEY" },
});
const body = await res.json();

if (body.success) console.log(body.data);
else console.error(body.error.code, body.error.message);
```

## Recorded response

A real Amo response, recorded and returned in Onekey's shape. Fields the platform does not provide are `null`.

```json
{
  "success": true,
  "data": [
    {
      "entity": {
        "id": "6490666"
      },
      "package": {
        "version": "1.75.0"
      },
      "content": {
        "createdAt": "2026-09-16T14:24:45Z",
        "text": null
      },
      "ext": {
        "sizeBytes": 4650100,
        "minFirefox": "115.0",
        "maxFirefox": "*"
      },
      "media": {
        "url": "https://addons.mozilla.org/firefox/downloads/file/5034826/ublock_origin-1.75.0.xpi"
      }
    },
    {
      "entity": {
        "id": "6437252"
      },
      "package": {
        "version": "1.74.0"
      },
      "content": {
        "createdAt": "2026-08-25T13:43:56Z",
        "text": {
          "en-US": "<ul><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/48253c92a003ef199957bdff8b2638c3db5763f2275d9c11d85f734899de727e/https%3A//github.com/gorhill/uBlock/commit/a46d5c8e75\" rel=\"nofollow\">Fix possible injection of scriptlets requiring trust from non-trusted sources</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/05ebfd636ec5cf2c078b7bff6d2ba1905ada270f86aca34c2cca1017f2c948f9/https%3A//github.com/gorhill/uBlock/commit/933efff4dd\" rel=\"nofollow\">Import <code>google-ima-dai</code> shim from AdGuard shims</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/d9db6f6022c7d27e0ae038056dab8c501361bfa5980865f004049611bc520255/https%3A//github.com/gorhill/uBlock/commit/20d3c5b9d0\" rel=\"nofollow\">Replace List-KR with filterslists-KO</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/1f363ab3acf1f19170709c2c903cce3907f693452ff40851b962df7a39e225c5/https%3A//github.com/gorhill/uBlock/commit/fb09b0947d\" rel=\"nofollow\">Remove support for <code>cap_user_stylesheet</code></a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/d50e2c0bc8fc79e52d90f699767fe85a88c6a0fc4860ae75fd140fc6835923fb/https%3A//github.com/gorhill/uBlock/commit/57ade5f484\" rel=\"nofollow\">Improve scriptlets framework</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/418881e9bd7810d869e4393e7262ae78fd34adac2c355fc1506031f179c87aec/https%3A//github.com/gorhill/uBlock/commit/0c56103a40\" rel=\"nofollow\">Add <code>env_brave</code> preparser token</a> (by @ryanbr)</li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/0810cde30d1a27090f09377cd1a864ab76d9cc5b50681cb8b9dc84efed4e962c/https%3A//github.com/gorhill/uBlock/commit/a796fd7daf\" rel=\"nofollow\">Add set/unset/given cookie values</a> (by @ryanbr)</li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/1abf98c4ff901e9d300e0cada3dc9578a6dcd3276feb6d77c035686463d22f29/https%3A//github.com/gorhill/uBlock/commit/25d413803d\" rel=\"nofollow\">Add procedural operator <code>content(...)</code>, to lookup elements inside <code>template</code> tags</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/4d0e25e1b08965bc34bde4102661c4bf41989894bb00c90b7de09d897fb01dc7/https%3A//github.com/gorhill/uBlock/commit/8a85e04907\" rel=\"nofollow\">Improve <code>prevent-clipboard-write</code> scriptlet</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/2315742021a2e44e78732a01f53e687d8930789815f0dfbaf18c3a0f0e1c17e0/https%3A//github.com/gorhill/uBlock/commit/0fdbfdb2b5\" rel=\"nofollow\">Improve <code>json-edit</code> scriptlet</a></li><li><a href=\"https://prod.outgoing.prod.webservices.mozgcp.net/v1/7f151b0f4123aa17151fdd43b26451560f1e9942fa06660617c7bb84fee252e0/https%3A//github.com/gorhill/uBlock/commit/505fbc7a75\" rel=\"nofollow\">Revisit scriptlets' <code>getExtraArgs</code> implementation</a></li></ul>"
        }
      },
      "ext": {
        "sizeBytes": 4617614,
        "minFirefox": "115.0",
        "maxFirefox": "*"
      },
      "media": {
        "url": "https://addons.mozilla.org/firefox/downloads/file/4981431/ublock_origin-1.74.0.xpi"
      }
    }
  ],
  "metadata": {
    "platform": "amo",
    "endpoint": "versions",
    "cached": false,
    "stale": false,
    "age_s": 0,
    "fetched_at": "2026-01-01T12:00:00+00:00",
    "credits_charged": 5,
    "request_id": "7f3a9c2e5b1d4c8fa2e6d0b9c4f18e37"
  },
  "error": null
}
```

## Field mapping

How this endpoint's source fields become Onekey's [unified schema](https://onekey.dev/docs/schema.md). Fields the source lacks come back as `null`.

| Source path | Onekey field | Transform |
| --- | --- | --- |
| `id` | `entity.id` | `toString` |
| `version` | `package.version` | - |
| `file.created` | `content.createdAt` | `toIsoDate` |
| `file.size` | `ext.sizeBytes` | `toNumber` |
| `compatibility.firefox.min` | `ext.minFirefox` | - |
| `compatibility.firefox.max` | `ext.maxFirefox` | - |
| `release_notes` | `content.text` | - |
| `file.url` | `media.url` | `safeUrl` |

## Caching and freshness

- Fresh for about 1 hour. Repeat calls in that window are served from cache and are free.
- Between 1 hour and 1 day the cached copy is still served instantly and marked `stale: true` while Onekey refreshes it in the background.
- If the source is down when a refresh is needed, the last copy can be served for up to 1 day more (marked stale).
- A "not found" is remembered for 1 minute and is free.
- The cache is shared across all customers, which is what keeps repeat calls cheap.

## What can go wrong

| Status | Code | What to do |
| --- | --- | --- |
| 401 | `unauthorized` | Check the `x-api-key` header. |
| 402 | `insufficient_credits` | [Add credits](https://onekey.dev/pricing); your balance must cover the price. |
| 404 | `not_found` | Unknown endpoint path. |
| 422 | `invalid_params` | Fix the parameters using the table above. Free. |
| 429 | `rate_limited` | Wait `Retry-After` seconds, then retry. |
| 502 | `upstream_error` | The source failed. Refunded; retry with backoff. |

See [Errors](https://onekey.dev/docs/errors.md) for the full list and retry guidance.

Status: stable (verified against the live source).
