---
title: "Payout drafts from text"
sidebarTitle: "Payout drafts (parse)"
description: "Turn free text or CSV lines into structured payout drafts. Drafts never send money; you approve them in the Storspay app."
---

<Info>
  **Drafts only.** `POST /v1/payout-drafts/parse` never sends money. Every payment is approved in the Storspay app with two-step sign-in. Storspay is a FINTRAC-registered money services business. Support: info@storsapp.com.
</Info>

Paste what you have (a chat message, an invoice line, a CSV export) and get back one structured draft per payout:
recipient, amount, currency, rail, and the problems found on that line.

## Request

`POST /v1/payout-drafts/parse` with a sandbox key (`sk_test_…`, on `api.sandbox.storspay.com`) or a live key
(`sk_live_…`, on `api.storspay.com`). The key needs the `create:payouts` or `agent:payouts` scope.

| Field | Type | |
|---|---|---|
| `text` | string | Free text or CSV, one payout per line (max 20,000 characters, 100 payouts). |
| `lines` | string[] | Instead of `text`: one payout per item. |
| `defaultCurrency` | `"EUR"` | Optional. Used for amounts written without a currency; such drafts still need review. |

Each line can look like any of these:

```text
pay Jane 200 EUR IBAN DE89 3704 0044 0532 0130 00
DE89 3704 0044 0532 0130 00 / Jane Example / €250
Jane Example;DE89370400440532013000;250,50;EUR
```

A CSV header row (for example `name;iban;amount;currency`) is skipped. A block of labelled lines
(`IBAN: …`, `Name: …`, `Amount: …`) separated by a blank line is one payout.

## Sandbox example

```bash
curl -X POST https://api.sandbox.storspay.com/v1/payout-drafts/parse \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{"text": "pay Jane 200 EUR IBAN DE89 3704 0044 0532 0130 00\npay Jean Exemple 1.250,50 EUR FR14 2004 1010 0505 0001 3M02 606\npay Bob 50 USD DE89370400440532013001"}'
```

Response (`201`):

```json
{
  "id": "pd_Xq3v9mB2kLp0aZ7yTn4w",
  "object": "payout_draft_batch",
  "mode": "sandbox",
  "drafts": [
    {
      "line": 1,
      "recipient": { "name": "Jane", "iban": "DE89370400440532013000", "country": "DEU" },
      "amount": "200.00",
      "currency": "EUR",
      "rail": "sepa",
      "status": "ready",
      "errors": []
    },
    {
      "line": 2,
      "recipient": { "name": "Jean Exemple", "iban": "FR1420041010050500013M02606", "country": "FRA" },
      "amount": "1250.50",
      "currency": "EUR",
      "rail": "sepa",
      "status": "ready",
      "errors": []
    },
    {
      "line": 3,
      "recipient": { "name": "Bob", "iban": "DE89370400440532013001", "country": null },
      "amount": "50.00",
      "currency": "USD",
      "rail": null,
      "status": "needs_review",
      "errors": ["invalid_iban", "unsupported_currency"]
    }
  ],
  "summary": { "count": 3, "ready": 2, "needsReview": 1 },
  "approveUrl": "https://app.storspay.com/dashboard/payout-drafts/pd_Xq3v9mB2kLp0aZ7yTn4w",
  "expiresAt": "2026-12-07T14:00:00.000Z",
  "sent": false
}
```

Amounts are decimal strings in major units (`"200.00"` = €200.00), see [Money and amounts](/concepts/money-and-amounts).
Drafts expire after 7 days.

## Validation errors per line

| Code | Meaning |
|---|---|
| `missing_iban` / `invalid_iban` | No IBAN found, or its check digits are wrong. |
| `unsupported_country` | The IBAN is valid but its country is not a SEPA country. |
| `missing_amount` | No amount found (amounts with more than 2 decimals are refused, never rounded). |
| `unclear_amount` | Currency missing, several amounts, or a form like `1,250` / `250.555` that could be thousands or decimals. |
| `amount_too_large` | Above the API maximum. |
| `unsupported_currency` | Only EUR to an IBAN (SEPA) can be drafted for now. |
| `missing_name` / `unclear_name` | No recipient name, or more than one candidate. |

A draft is `ready` only when it has no errors. Request errors (empty text, too long, more than 100 payouts) answer
`400 VALIDATION_ERROR` with `details.reason` = `empty`, `too_long` or `too_many_lines`. See [Errors](/concepts/errors).

## Approving

Open `approveUrl` signed in to Storspay to review the drafts, then pay through the normal payment screen.
Each payment needs your two-step sign-in. The API has no call that turns a draft into a payment.

## Telegram

The same parser runs behind the Storspay Telegram bot. In the app, open **Settings → Connect Telegram**, tap the
one-time link, and send payout details to the bot. It replies with the draft summary and the approve link.
