URL: /code/apps/ads/spend · Id: `page:/code/apps/ads/spend`

# Mandate.spend

> Pays an outside party with a single-use card, inside your standing approval.

POST https://api.sb/&#123;your-domain&#125;/mandates/&#123;mandate&#125;/spend

Pays an outside party with a single-use card, inside your standing approval.

- **Action class:** `spend`
- **Approval:** Asks above your rule
- **Emits:** `Mandate.spent`
- **Price:** Free

```text title="Run it · Ask"
Pay the $49 listing fee for the property-management directory from the paid-media mandate.
```

```ts title="Run it · SDK"
import { $ } from 'startup-builder'

const result = await $.try.Mandate.spend({ mandate: 'https://api.sb/leaseline.app/mandates/mandate_Pm6dA2sP9n', amount: { amount: 49, currency: 'USD' }, payee: 'Property management software directory' })
```

```json title="Run it · Response"
{
  "api": "https://api.sb/leaseline.app",
  "transaction": {
    "$id": "https://api.sb/leaseline.app/transactions/transaction_Dl8fE4cQ1m",
    "$type": "Transaction",
    "amount": {
      "amount": 49,
      "currency": "USD"
    }
  },
  "mandate": {
    "$id": "https://api.sb/leaseline.app/mandates/mandate_Pm6dA2sP9n",
    "$type": "Mandate",
    "remaining": {
      "amount": 251,
      "currency": "USD"
    }
  },
  "action": {
    "operation": "Mandate.spend",
    "mode": "try",
    "status": "done"
  }
}
```

Its Inputs, Outputs, Effects and guards quote [the hub’s `Mandate.spend`](https://startupbuilder.dev/business/nouns/mandate/spend); this page adds what each Venue honors, its limits and a worked call. It is one of the [Verbs](https://startupbuilder.dev/business/nouns/verb) of [Ads](/code/apps/ads#verbs).

## Inputs
| Name | Type | Default | Meaning |
| --- | --- | --- | --- |
| `mandate` | `Mandate` | Required | The standing approval that covers the purchase. |
| `amount` | `money` | Required | The amount to spend. |
| `payee` | `string` | Required | Who is paid. |

## Outputs
| Field | Type | What `null` means |
| --- | --- | --- |
| `transaction` | `Transaction` | Never null: the card Transaction. |
| `mandate` | `Mandate` | Never null: your standing approval with its remaining Limit. |

## Effects
**Action class**

`spend`: an approval rule on `spend` can make it wait for your OK

**Modes**

- `try`: Runs every check and returns what would go out, as it would go out; nothing is sent, posted or spent.
- `send`: Returns a pending Action at once; `Mandate.spent` fires when it is done.
- `do`: Waits for the Action to finish and returns the record.

**Idempotency**

Only with a key: the same `Idempotency-Key` and input return the first Action, and the same key with other input returns `409`.

**Saved or shared**

Checks your standing approval’s Limit; above it, opens an Approval and the Action waits. Posts a cost Entry against the Action that spent.

**Emits**

`Mandate.spent` with `{ mandate }`

**Performed by**

Whichever seat calls it

**Price**

Free on your own account. The spend is billed by the Venue directly.

**Standing approval**

It asks you first above its seat rule, unless a standing approval covers it: a [`Mandate`](https://startupbuilder.dev/business/nouns/mandate) you grant once with [`Mandate.authorize`](/code/integrations/calls/authorize).

## On each Venue
It acts on your own records and reaches no Venue, so every account answers the same way.

## What try does
Runs every check the call meets and returns the record as it would be; nothing is stored, sent or posted.

## Refuses when
The hub sets no guard of its own on this call: it refuses only on the shared checks every write meets (a missing record, a Permission the seat lacks).

## When it waits
It waits for your approval when the step is over your rule and no standing approval covers it; otherwise it returns in one response.

## Example
In `send` mode the call returns its pending Action at once, and `Mandate.spent` delivers the result.

**Ask**

```text
Pay the $49 listing fee for the property-management directory from the
paid-media mandate.
```

**API**

```bash
curl -X POST "https://api.sb/leaseline.app/mandates/mandate_Pm6dA2sP9n/spend?mode=send" \
  -H "Authorization: Bearer $SB_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "amount": {
    "amount": 49,
    "currency": "USD"
  },
  "payee": "Property management software directory"
}'
```

**CLI**

```bash
npx startup-builder do Mandate.spend --send --data '{
  "amount": {
    "amount": 49,
    "currency": "USD"
  },
  "payee": "Property management software directory"
}'
```

`--send` returns the pending Action at once.

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "mode": "send",
    "code": "return await $.Mandate.spend({ amount: { amount: 49, currency: 'USD' }, payee: 'Property management software directory' })"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const result = await $.send.Mandate.spend({
  mandate: 'https://api.sb/leaseline.app/mandates/mandate_Pm6dA2sP9n',
  amount: { amount: 49, currency: 'USD' },
  payee: 'Property management software directory',
})
```


```json title="Response, in send mode"
{
  "mode": "send",
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/action_Sd3kQ9vT2w",
    "operation": "Mandate.spend",
    "status": "pending",
    "reason": "running"
  }
}
```

To retry, send the same `Idempotency-Key`: the retry returns the first answer for $0. A new key reads again.

## Used by
- **Jobs:** [Reach out](/capabilities/reach-out)

## Related
[`Audience.create`](/code/apps/ads/create-audience) · [`Campaign.create`](/code/apps/ads/create-campaign) · [`Campaign.update`](/code/apps/ads/update-campaign) · [`Ad.create`](/code/apps/ads/create-ad) · [`Ad.update`](/code/apps/ads/update-ad)