> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fetchski-attract.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List the enabled Conversions

> Every enabled Conversion, compiled: its key, the platforms it sends to and how (from the page, the server or both — never the platforms’ own IDs), and what triggers it (counts only — never the forms, pages or links themselves).

```ts TypeScript wrap theme={"dark"}
import { createSiteClient } from '@fetchski/attract-cms-sdk';

const site = createSiteClient();
const listConversionDefinitions = await site.conversions().listConversionDefinitions();
```

```json 200 wrap theme={"dark"}
{
  "conversions": [
    {
      "id": "ckq1w2e3r4t5y6u7i8o9p0",
      "key": "booking",
      "title": "Booking",
      "currency": "USD",
      "counting": "every",
      "destinations": [
        "google-ads",
        "meta",
        "tiktok"
      ],
      "platforms": {
        "google-ads": {
          "browser": true,
          "server": true
        },
        "meta": {
          "browser": true,
          "server": true
        },
        "tiktok": {
          "browser": false,
          "server": true
        }
      },
      "sendUserData": true,
      "triggers": {
        "forms": 0,
        "pageViews": 0,
        "links": 0,
        "outbound": false,
        "downloads": 0,
        "chat": [],
        "external": true
      }
    }
  ]
}
```

## In your app

A function makes the call on the client it is given, so your code passes the real one and a test passes a fake.

**1. Add the function**

```ts src/attract/list-conversion-definitions.ts theme={"dark"}
import type { SiteClient } from '@fetchski/attract-cms-sdk';

export async function listConversionDefinitions(site: SiteClient) {
  return site.conversions().listConversionDefinitions();
}
```

**2. Call it**

A script makes the client once and calls the function:

```ts scripts/list-conversion-definitions.ts theme={"dark"}
import { createSiteClient } from '@fetchski/attract-cms-sdk';
import { listConversionDefinitions } from '../src/attract/list-conversion-definitions.ts';

const site = createSiteClient();
console.log(await listConversionDefinitions(site));
```

```bash Terminal theme={"dark"}
node --env-file=.env scripts/list-conversion-definitions.ts
```

A route handler, a job or a queue worker calls it the same way.

Another system uses it to find the Conversion to post facts to: `triggers.external: true` accepts `POST /conversion-event/external`, naming the Conversion by its `id` or `key`.

> [accordion] Parameters
>
> None: call it with no arguments.

> [accordion] Returns
>
> A `ListConversionDefinitionsResponse`. The enabled Conversions. Read its properties (`listConversionDefinitions.conversions`): each says whether the site always sends it.
>
> **conversions** `readonly ConversionDefinition[]`
>
> **Always sent.** A list of `ConversionDefinition`.
>
> **ConversionDefinition**
>
> **id** `string`
>
> **Always sent.**
>
> **key** `string`
>
> **Always sent.** The Conversion’s neutral name (its key in the CMS): what the Data API, webhooks and the events list carry, and what Google Analytics and Tag Manager receive as `conversion_key`. Matches `^[a-z0-9]+(?:-[a-z0-9]+)*$`.
>
> **currency** `string`
>
> **Always sent.** Matches `^[A-Z]{3}$`.
>
> **counting** `Counting`
>
> **Always sent.** One of `once`, `every`; a newer site may send others, so keep a fallback.
>
> **destinations** `readonly Destinations[]`
>
> **Always sent.** The platforms it sends to (its switched-on rows). Each one of `google-ads`, `ga4`, `gtm`, `meta`, `tiktok`.
>
> **platforms** `Readonly\<Record\<string, ConversionDefinitionPlatformsValue\>\>`
>
> **Always sent.** A map of names to `ConversionDefinitionPlatformsValue`. Per platform in `destinations`: whether the page’s tag sends it, the server, or both.
>
> **ConversionDefinitionPlatformsValue**
>
> **browser** `boolean`
>
> **Always sent.**
>
> **server** `boolean`
>
> **Always sent.**
>
> **sendUserData** `boolean`
>
> **Always sent.**
>
> **triggers** `ConversionDefinitionTriggers`
>
> **Always sent.** A `ConversionDefinitionTriggers`.
>
> **ConversionDefinitionTriggers**
>
> Required.
>
> **forms** `number`
>
> **Always sent.** How many forms fire it. At least 0.
>
> **pageViews** `number`
>
> **Always sent.** At least 0.
>
> **links** `number`
>
> **Always sent.** How many link rules fire it (phone, email, text, directions, listed websites, written patterns). At least 0.
>
> **outbound** `boolean`
>
> **Always sent.** Fires on any link that leaves the site.
>
> **downloads** `number`
>
> **Always sent.** How many file types fire it when downloaded. At least 0.
>
> **chat** `readonly string[]`
>
> **Always sent.**
>
> **external** `boolean`
>
> **Always sent.** Accepts facts posted to `POST /conversion-event/external`.
>
> **title** `string`
>
> **Sometimes sent:** `undefined` when the site leaves it out.
>
> **value** `number`
>
> **Sometimes sent:** `undefined` when the site leaves it out. At least 0.

> [accordion] Errors
>
> Nothing to catch: the SDK retries what is safe, and throws the rest as the classes below; catch only what you want to react to (see [Errors and testing](https://docs.fetchski-attract.com/typescript/errors.md)).
>
> **AuthenticationFailed** `401`
>
> The API key is missing, malformed, unknown, disabled, expired or archived (`invalid`), or a request that must be signed — by the route, or by the key’s own signing mode — has a missing, stale or wrong signature (an upload signs its SHA-256, declared in `X-Fetchski-Content-SHA256`, in the body’s place) (`unauthorized`).
>
> **Retried first:** No. **Read:** `siteMessage`, `errorName`, `data`.
>
> **Forbidden** `403`
>
> The API key lacks the scope this route needs (the message names it), or the key is used from an address outside its allowlist.
>
> **Retried first:** No. **Read:** `siteMessage`, `errorName`, `data`.
>
> **NotFound** `404`
>
> Nothing with this identifier — or the caller may not use the Data API at all (anonymous visitors and non-admin sessions get 404 so the API is not advertised). A write while conversion tracking is switched off also answers 404.
>
> **Retried first:** No. **Read:** `siteMessage`, `errorName`, `data`.
>
> **RateLimited** `429`
>
> The key used up its reads- or writes-per-minute limit (set per key; defaults 600 / 120). Still, after the client’s own waits and retries.
>
> **Retried first:** Yes: the client waits `Retry-After` (1 s when absent; over 60 s it gives up at once) and retries, up to `retries` times (2 by default). **Read:** `retryAfter` (seconds, or null), `siteMessage`.
>
> **SiteError** `5xx`
>
> The site failed (or something in front of it did). Its logs say why.
>
> **Retried first:** A 502, 503 or 504: yes, after 0.5 s then 1 s. A 500: no. **Read:** `siteMessage`, `errorName`, `data`.
>
> **SiteUnreachable** `no answer`
>
> No answer: DNS, a refused connection, TLS, or the timeout (15 s per attempt by default).
>
> **Retried first:** Yes, after 0.5 s then 1 s. **Read:** `reason`, `neverConnected`.
>
> **RequestNotSent** `not sent`
>
> The client refused to send it (e.g. a path segment of `..`); the site never saw it.
>
> **Retried first:** No. **Read:** `reason` (what to change).
>
> **SiteRequestFailed** `any other`
>
> Any other status, or a success whose JSON doesn’t match this SDK version’s types (update the SDK).
>
> **Retried first:** No. **Read:** `reason`, `status`.
>
> **UnknownSite** `setup`
>
> `sites.forSite('acme')` named a slug your sites (`createSiteClients()`) don’t have.
>
> **Retried first:** No: nothing was sent. **Read:** `message`, `slug`.
>
> **SiteConfigurationError** `setup`
>
> The client’s settings are wrong: no `FETCHSKI_ATTRACT_URL` (or `baseUrl`), or a malformed API key.
>
> **Retried first:** No: nothing was sent. **Read:** `message` (what to fix).

## Behavior

* **Access:** an API key with `conversions:read` — or its group master `ads:all`, or `admin:all` — or a signed-in user holding the `conversion-events:view` permission. Anonymous callers get 404.
* **Rate limit:** the key’s own reads-per-minute limit, set when the key is created (default 600); over it, 429 with `Retry-After`. The client waits and retries for you; you see `RateLimited` only if that runs out.
* **Retries:** a read is safe to repeat: the client retries it on no answer, a 502/503/504 and a 429.
* **Timeout:** 15 s per attempt by default; raise `timeout` (milliseconds) on the client for longer.

## Test it

It calls the function above with a fake client: the fake answers every call with a valid example, so nothing leaves your machine and no settings or key are needed. Run it with `node --test`.

```ts tests/conversions-listConversionDefinitions.test.ts theme={"dark"}
import { test } from 'node:test';
import { fakeSite } from '@fetchski/attract-cms-sdk/testing';
import { listConversionDefinitions } from '../src/attract/list-conversion-definitions.ts';

test('conversions.listConversionDefinitions', async () => {
  const site = fakeSite();
  await listConversionDefinitions(site);
  site.assertCalled('conversions.listConversionDefinitions');
});
```

## Related

> [card] [Conversions the page can fire (public)](https://docs.fetchski-attract.com/typescript/reference/conversions/list-active-conversions.md)
>
> `site.conversions().listActiveConversions()`

> [card] [GET /conversion/definitions](https://docs.fetchski-attract.com/api-reference/conversions/list-the-enabled-conversions.md)
>
> The endpoint this calls, in the API reference: the HTTP request and answer, and every rule the site checks.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.