# Catalog

> Search the apps Lodol works with, list an app's actions, look up an action's or a trigger's fields, and find triggers, to build workflows from your own code.

Web page: https://docs.lodol.com/docs/api/catalog

The catalog is what a workflow can be built from: the apps Lodol works with, the actions each can take, and the triggers that start a workflow. Use it with [Create a workflow](https://docs.lodol.com/docs/api/workflows.md#create-a-workflow) and the [workflow format](https://docs.lodol.com/docs/api/workflow-format.md). Any valid key can call these endpoints; they need no scope.

The searches take `search`, in plain words: an app's name (`HubSpot`), something to do (`send an SMS`) or a category (`CRM`). They need it: a search without it gets `400`. Each answers with its best `limit` matches, from 1 to 25 (10 unless you ask), on one page, with no cursor. Apps the workspace has hidden aren't listed.

---

## Search apps

<Endpoint method="GET" path="/api/v1/apps" />

<Fields title="Query parameters">
<Field id="search" type="string" description="What you're looking for, up to 200 characters." facts="Required." />
<Field id="limit" type="integer" description="How many to return, from 1 to 25." facts="Default: `10`." />
</Fields>

```bash tab="cURL" tab-group="lang"
curl "https://api-prod.lodol.com/api/v1/apps?search=stripe&limit=2" \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

```js tab="JavaScript"
const params = new URLSearchParams({ search: 'stripe', limit: '2' });
const response = await fetch(`https://api-prod.lodol.com/api/v1/apps?${params}`, {
  headers: { Authorization: `Bearer ${process.env.LODOL_API_KEY}` },
});
const { apps } = await response.json();
```

```python tab="Python"
response = requests.get(
    "https://api-prod.lodol.com/api/v1/apps",
    headers={"Authorization": f"Bearer {os.environ['LODOL_API_KEY']}"},
    params={"search": "stripe", "limit": 2},
)
apps = response.json()["apps"]
```

**Response `200`:** the best matches first. `connected` says whether the key's member has a connection to the app.

```json
{
  "apps": [
    {
      "id": "stripe",
      "name": "Stripe",
      "description": "Take payments, send payment links and invoices, issue refunds, manage subscriptions and coupons, and follow customers.",
      "categories": ["Payments & Billing", "E-Commerce"],
      "connected": false
    },
    {
      "id": "govee",
      "name": "Govee",
      "description": "Control your Govee lights, plugs and appliances: turn them on or off, set brightness, color and scenes, and read sensors.",
      "categories": ["Smart Home & Cars"],
      "connected": false
    }
  ]
}
```

To see how an app connects and which credentials it takes, use [How an app connects](https://docs.lodol.com/docs/api/connections.md#how-an-app-connects).

---

## List an app's actions

<Endpoint method="GET" path="/api/v1/apps/:app_id/actions" />

Returns the actions an app offers, a page at a time. [List an app's triggers](#list-an-apps-triggers) lists what can start a workflow from it. `:app_id` is the app's ID, or its name. An app there's none of returns `404`, suggesting the closest.

<Fields title="Query parameters">
<Field id="limit" type="integer" description="How many to return, from 1 to 100." facts="Default: `50`." />
<Field id="cursor" type="string" description="For the next page: the next_cursor of the page you have." />
</Fields>

```bash
curl https://api-prod.lodol.com/api/v1/apps/stripe/actions \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

**Response `200`:** each action with its `id`, its app, a `description`, and whether the key's member has `connected` the app. `next_cursor` gets the next page; see [Paging through lists](https://docs.lodol.com/docs/api.md#paging-through-lists).

```json
{
  "actions": [
    {
      "id": "stripe_create_customer",
      "app_id": "stripe",
      "app_name": "Stripe",
      "description": "Add a customer to Stripe with their email and, if you like, their name, phone number and a note.",
      "connected": false
    },
    "..."
  ],
  "next_cursor": null
}
```

---

## List an app's triggers

<Endpoint method="GET" path="/api/v1/apps/:app_id/triggers" />

Returns the triggers an app offers, a page at a time, as [Search triggers](#search-triggers) describes them. An app there's none of returns `404`.

<Fields title="Query parameters">
<Field id="limit" type="integer" description="How many to return, from 1 to 100." facts="Default: `50`." />
<Field id="cursor" type="string" description="For the next page: the next_cursor of the page you have." />
</Fields>

```bash
curl https://api-prod.lodol.com/api/v1/apps/stripe/triggers \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

**Response `200`:** `next_cursor` gets the next page.

```json
{
  "triggers": [
    {
      "id": "stripe_new_payment_trigger",
      "app_id": "stripe",
      "app_name": "Stripe",
      "name": "New payment",
      "description": "Runs when someone pays you in Stripe or, with a status chosen, when a payment reaches that status."
    },
    "..."
  ],
  "next_cursor": null
}
```

---

## Search actions

<Endpoint method="GET" path="/api/v1/actions" />

Finds actions across every app.

<Fields title="Query parameters">
<Field id="search" type="string" description="What you want to do, up to 200 characters, such as create a refund." facts="Required." />
<Field id="limit" type="integer" description="How many to return, from 1 to 25." facts="Default: `10`." />
</Fields>

```bash
curl "https://api-prod.lodol.com/api/v1/actions?search=create%20a%20refund&limit=2" \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

**Response `200`:**

```json
{
  "actions": [
    {
      "id": "cash_app_create_refund",
      "app_id": "cash_app",
      "app_name": "Cash App",
      "description": "Create a refund from a merchant to a customer.",
      "connected": false
    },
    {
      "id": "quickbooks_create_refund_receipt",
      "app_id": "quickbooks",
      "app_name": "QuickBooks Online",
      "description": "Refund a customer: record money paid back to them out of a bank account.",
      "connected": false
    }
  ]
}
```

---

## Get an action

<Endpoint method="GET" path="/api/v1/actions/:id" />

Returns everything about one action: its parameters, with their types and whether each is required, and what it returns. An ID there's no action with returns `404` with the code `not_found`, suggesting the closest:

```json
{
  "error": "No action with id 'stripe_create_custmer'. Did you mean stripe_create_customer, stripe_create_price, stripe_create_coupon?",
  "error_code": "not_found"
}
```

```bash
curl https://api-prod.lodol.com/api/v1/actions/stripe_create_customer \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

**Response `200`:** `path` is how a workflow names the action, as the path argument of an app action's call in the [workflow format](https://docs.lodol.com/docs/api/workflow-format.md).

```json
{
  "id": "stripe_create_customer",
  "app_id": "stripe",
  "app_name": "Stripe",
  "description": "Add a customer to Stripe with their email and, if you like, their name, phone number and a note.",
  "path": "/actions/library/stripe/create-customer",
  "parameters": [
    { "name": "email", "type": "string", "required": true, "description": "The customer's email address.", "dynamic": false },
    { "name": "name", "type": "string", "required": false, "description": "The customer's full name or business name.", "dynamic": false },
    { "name": "description", "type": "string", "required": false, "description": "A note about the customer. Only your team sees it, in Stripe.", "dynamic": false },
    { "name": "phone", "type": "string", "required": false, "description": "The customer's phone number.", "dynamic": false }
  ],
  "returns": {
    "type": "object",
    "description": "The new customer: their id, email, name and the rest of what Stripe keeps about them.",
    "properties": {
      "id": { "type": "string", "description": "The customer's id in Stripe, which starts with cus_." },
      "email": { "type": "string", "description": "Their email address; blank when Stripe has none." },
      "...": "..."
    }
  }
}
```

---

## Search triggers

<Endpoint method="GET" path="/api/v1/triggers" />

Finds the triggers that can start a workflow, across every app.

<Fields title="Query parameters">
<Field id="search" type="string" description="What should start the workflow, up to 200 characters, such as new Stripe payment." facts="Required." />
<Field id="limit" type="integer" description="How many to return, from 1 to 25." facts="Default: `10`." />
</Fields>

```bash
curl "https://api-prod.lodol.com/api/v1/triggers?search=new%20stripe%20payment&limit=1" \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

**Response `200`:**

```json
{
  "triggers": [
    {
      "id": "stripe_new_payment_trigger",
      "app_id": "stripe",
      "app_name": "Stripe",
      "name": "New payment",
      "description": "Runs when someone pays you in Stripe or, with a status chosen, when a payment reaches that status."
    }
  ]
}
```

---

## Get a trigger

<Endpoint method="GET" path="/api/v1/triggers/:id" />

Returns one trigger, with its `parameters`, the settings it takes, and `output`, the fields of the event it starts a run with. An ID there's no trigger with returns `404`, suggesting the closest.

```bash
curl https://api-prod.lodol.com/api/v1/triggers/stripe_new_payment_trigger \
  -H "Authorization: Bearer $LODOL_API_KEY"
```

**Response `200`:**

```json
{
  "id": "stripe_new_payment_trigger",
  "app_id": "stripe",
  "app_name": "Stripe",
  "name": "New payment",
  "description": "Runs when someone pays you in Stripe or, with a status chosen, when a payment reaches that status.",
  "parameters": [
    {
      "name": "status",
      "arg_index": 0,
      "required": false,
      "description": "Only run for payments in this state, such as succeeded. Leave empty to run once for every new payment, including ones still waiting for the customer to pay."
    },
    {
      "name": "minimum_amount",
      "arg_index": 1,
      "required": false,
      "description": "Only run for payments of at least this much, in dollars (or your currency), not cents: 1000 means $1,000. Leave empty to run for every amount."
    }
  ],
  "output": {
    "payment_intent_id": "The payment's id in Stripe (pi_...).",
    "amount": "The amount in cents (or the currency's smallest unit), so 5000 is $50.00.",
    "currency": "The three-letter currency code, such as usd.",
    "...": "..."
  }
}
```
