# Create sender

> POST /v1/senders

`POST https://api.zavu.dev/v1/senders`

## Body

- `name` (string, required)
- `phoneNumber` (string): Phone number in E.164 format, and it must be a number your project already owns (see `GET /v1/phone-numbers`). The number is routed to the sender as part of this call, which is what turns the SMS channel on. Passing a number the project does not own, one already attached to another sender, or one rejected in regulatory review returns 400 rather than creating a sender that cannot send. A number still under review is attached and starts carrying messages when it is approved. Omit for an email-only sender.
- `enableVoice` (boolean): Let this sender place and answer phone calls. Requires `phoneNumber`; enabling it without one returns 400. Check the `channels` array on the response to confirm `voice` is on.
- `enableSmsOneway` (boolean): Enable the one-way SMS channel (`sms_oneway`). No phone number and no credential, so it is the fastest way to get a sender that can send. Recipients cannot reply. Sending to a US or Canadian (+1) number still needs an approved 10DLC campaign, and is refused with `403 ten_dlc_required` until then. Confirm with `sms_oneway` in the `channels` array on the response.
- `setAsDefault` (boolean)
- `webhookUrl` (string<uri>): HTTPS URL for webhook events.
- `webhookEvents` (string[]): Events to subscribe to. One of: `message.queued`, `message.sent`, `message.delivered`, `message.read`, `message.status`, `message.failed`, `message.inbound`, `message.unsupported`, `broadcast.status_changed`, `conversation.new`, `contact.identity_linked`, `template.status_changed`, `invitation.status_changed`, `call.initiated`, `call.answered`, `call.completed`, `call.failed`, `domain.verified`, `domain.failed`.
- `emailAddress` (string<email>): From-address for the email channel (e.g. noreply@yourdomain.com). The address's domain must be a verified email domain in your project. Setting this attaches the email channel to the sender.
- `emailDomainId` (string): ID of the verified email domain to attach. Optional — resolved from `emailAddress`'s domain when omitted.
- `emailFromName` (string): Display name shown in the recipient's inbox for the email channel.
- `emailReceivingEnabled` (boolean): Enable inbound email receiving on this sender. Requires a verified inbound MX record on the domain; the request is ignored otherwise. Read `emailReceivingEnabled` back off the response to see whether it was applied — it comes back `false` when the MX has not verified.
- `webhookSignatureVersion` (string): Signature scheme for this sender's webhook. Defaults to `v2`, which is correct for a new receiver. Pass `v1+v2` when this sender points at an endpoint that already serves an older sender still verifying `v1`. One of: `v1`, `v1+v2`, `v2`.

## Responses

### 201

Sender created.

- `id` (string, required)
- `name` (string, required)
- `phoneNumber` (string): Phone number in E.164 format. Absent on a sender that has none: an email-only sender, or one created with only `enableSmsOneway`.
- `channels` (string[]): Channels this sender can actually send on right now: configured AND activated. Empty means the sender cannot send or receive anything yet: a phoneNumber alone does not enable SMS or voice, and a connected account that is not activated is left out, because every send on it is refused. Check this rather than inferring capability from phoneNumber or emailAddress, and turn a connected channel on with `POST /v1/senders/{senderId}/channels/{channel}/activate`.
- `isDefault` (boolean): Whether this sender is the project's default.
- `webhook` (object): Webhook configuration for the sender.
  - `url` (string<uri>, required): HTTPS URL that will receive webhook events.
  - `events` (string[], required): List of events the webhook is subscribed to. One of: `message.queued`, `message.sent`, `message.delivered`, `message.read`, `message.status`, `message.failed`, `message.inbound`, `message.unsupported`, `broadcast.status_changed`, `conversation.new`, `contact.identity_linked`, `template.status_changed`, `invitation.status_changed`, `call.initiated`, `call.answered`, `call.completed`, `call.failed`, `domain.verified`, `domain.failed`.
  - `secret` (string): Webhook secret for signature verification. Only returned on create or regenerate.
  - `active` (boolean, required): Whether the webhook is active.
  - `signatureVersion` (string, required): Which `X-Zavu-Signature` scheme this receiver is sent. - `v1`: `v1=HMAC_SHA256(secret, body)`. The scheme used before this was configurable. Existing webhooks stay on it until you move them. - `v2`: `v2=HMAC_SHA256(secret, "{t}.{body}")`. The current scheme, and the default for new senders. It signs the timestamp together with the body. - `v1+v2`: both signatures, sharing one `t`. The migration setting: a receiver reading either one works, so you can deploy and confirm your new verifier before switching over. Moving from `v1` straight to `v2` returns `400`. Set `v1+v2` first. See https://www.zavu.dev/docs/guides/receiving-messages/signature-migration One of: `v1`, `v1+v2`, `v2`.
- `whatsapp` (object): WhatsApp Business Account information. Only present if a WABA is connected.
  - `phoneNumberId` (string): WhatsApp phone number ID from Meta.
  - `displayPhoneNumber` (string): Display phone number.
  - `paymentStatus` (object): Payment configuration status from Meta.
    - `setupStatus` (string): Payment setup status (COMPLETE, NOT_STARTED, etc.).
    - `methodStatus` (string): Payment method status (VALID, NONE, etc.).
    - `canSendTemplates` (boolean): Whether template messages can be sent. Requires setupStatus=COMPLETE and methodStatus=VALID.
- `emailAddress` (string): From-address for the email channel, if configured.
- `emailReceivingEnabled` (boolean): Whether inbound email receiving is enabled for this sender.
- `emailCatchAllEnabled` (boolean): Whether catch-all receiving is enabled. When true (and emailReceivingEnabled is true), this sender receives email addressed to any local part at its domain, not just its own address. The original recipient is delivered in the message.inbound webhook's data.to.
- `createdAt` (string<date-time>)
- `updatedAt` (string<date-time>)

### 400

Invalid sender.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X POST "https://api.zavu.dev/v1/senders" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string"
}'
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.senders.create({
  name: "string",
});

console.log(result);
```
