# import

URL: /business/nouns/newsletter/import · Id: `verb:Newsletter.import` · Call: `await $.Newsletter.import({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Import adds subscribers from a CSV File, keeping each one’s consent basis and the date they subscribed.

Import adds subscribers from a CSV [File](/business/nouns/file), keeping each one’s consent basis and the date they subscribed.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `newsletter` | [Newsletter](/business/nouns/newsletter) | Yes | The Newsletter. |
| `file` | [File](/business/nouns/file) | Yes | The CSV, one subscriber per row. |
| `basis` | `string` | Yes | How they consented, as the old tool recorded it. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `newsletter` | [Newsletter](/business/nouns/newsletter) | Yes | The Newsletter, with its new subscribers counted. |

## Effects
| Fact | Value |
| --- | --- |
| Action class | None: it runs within its seat's Limits |
| Door | Two-way: it runs at once |
| Modes | `try` previews it and stores nothing; `send` returns a pending Action; `do` (default) waits for the result |
| Idempotent | With a key: a repeat with the same `Idempotency-Key` returns the first Action, and a repeat without one runs again |
| Undo | [Action.undo](/business/nouns/action/undo) reverses it |
| Emits | [`Newsletter.imported`](/business/events/Newsletter.imported) |
| Performed by | The [Marketing Lead](/agents/marketing/marketing-lead) |

- Refuses a row with no email, and skips a suppressed address.
- Writes one Consent per subscriber, with its basis and date.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |
| A row with no email, and skips a suppressed address | [`refused`](/code/api/errors/refused) | Clear what the check names, then call it again. | None. |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Import the latest newsletter with a file.
```

**API**

```bash
curl -X POST https://api.sb/leaseline.app/newsletters/newsletter_FLjN3aQujc/import \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file":"file_V1AuhyCTsH","basis":"Example basis"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "newsletter": {
    "$id": "https://api.sb/leaseline.app/newsletters/newsletter_FLjN3aQujc",
    "$type": "Newsletter",
    "name": "Leaseline notes",
    "from": "mailbox_93HvOnR17L"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Newsletter.import",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

**SDK**

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

const newsletter = await $.Newsletter.import({ newsletter: 'newsletter_FLjN3aQujc', file: 'file_V1AuhyCTsH', basis: 'Example basis' })
```

**CLI**

```bash
npx startup-builder do Newsletter.import --json '{"newsletter":"newsletter_FLjN3aQujc","file":"file_V1AuhyCTsH","basis":"Example basis"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Newsletter.import({ newsletter: 'newsletter_FLjN3aQujc', file: 'file_V1AuhyCTsH', basis: 'Example basis' })"
  }
}
```