> For the complete documentation index, see [llms.txt](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/guides/sending-usdc.md).

# Sending USDC programmatically

The canonical call:

```ts
const result = await bs.agents.send(agentId, { to, amount, memo });
```

## Inputs

| Field    | Type    | Notes                                     |
| -------- | ------- | ----------------------------------------- |
| `to`     | string  | base58 Solana address, 32–64 chars        |
| `amount` | number  | whole USDC, positive, up to 6 decimals    |
| `memo`   | string? | ≤ 200 chars, written to the on-chain memo |

## Outputs

```ts
{ status: "sent", signature: "5K..." }
{ status: "pending_approval", approval_id: "uuid" }
```

Or throws a `BlackSheepError`:

* `400` — invalid input.
* `403` — `Blocked by policy` (see audit log for which rule).
* `404` — agent not found.
* `409` — insufficient USDC / SOL on the wallet.

## Idempotency

`send` is **not** idempotent. Calling it twice with the same payload sends twice. If you need at-most-once semantics, generate your own request ID, store it client-side before calling `send`, and skip duplicates.

A native `Idempotency-Key` header is on the roadmap.

## Fees

* Solana network fee: \~0.000005 SOL per tx (paid from the agent's SOL balance).
* Black Sheep platform fee: **none** on the open beta.

## Confirmation semantics

The call resolves only after the tx is `confirmed` (Solana commitment level `confirmed`, not `finalized`). For most use cases this is enough; if you need `finalized`, re-fetch the signature later via Solana RPC.

## Bulk sends

For lists of payments, fire `send` concurrently with a small concurrency limit (e.g. p-limit 5). The server handles them independently — there's no batch endpoint yet.

```ts
import pLimit from "p-limit";
const limit = pLimit(5);
await Promise.all(invoices.map(inv =>
  limit(() => bs.agents.send(agentId, { to: inv.to, amount: inv.amount, memo: inv.id }))
));
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://black-sheep-finance.gitbook.io/black-sheep-finance-docs/guides/sending-usdc.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
