---
title: "Email a site's invocation codes"
type: reference
method: POST
path: /rest-api/sites/{siteId}/invocation-codes/send.do
tag: "Sites"
---

# Email a site's invocation codes

`POST https://YOUR-NETWORK-DOMAIN/rest-api/sites/{siteId}/invocation-codes/send.do`

Emails the chosen invocation codes of the site's placements to up to 20 recipients, through the network's invocation-code email template, whose subject and body the request's subject and body replace when sent. A network without that template can still mail them when the request sends both subject and body. The message is always sent from the caller's own address. Code types the caller may not generate for a placement are rejected, and every placement must be a live placement of the site in the path. Requires VIEW access to the site's inventory (ALL, or SHARED with a share on the site).

## Path params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `siteId` | integer | yes | `5001` | Site ID |

## Form params

| Name | Type | Required | Example | Description |
|---|---|---|---|---|
| `bccAuthor` | boolean | no | `false` | Send a blind copy to the caller's own address |
| `body` | string | no | `<p>Tags for your site are attached.</p>` | Email HTML body; the invocation-code email template's body when omitted. Required, with subject, when the network has no such template |
| `emails` | array<string> | no | `publisher@example.com` | Recipient addresses, at most 20 |
| `placementInvocationCodes` | object | no | `{"4001": "AJAX"}` | Code types to send per placement ID. Every placement must belong to the site in the path. |
| `singleFile` | boolean | no | `true` | Attach every code in one text file (true) or one file per placement and code type (false) |
| `subject` | string | no | `Your ad tags` | Email subject; the invocation-code email template's subject when omitted. Required, with body, when the network has no such template |

## Responses

- `200` — {success, recipients} — the codes were handed to the mailer
- `400` — Invalid recipients, no placements, a placement of another site, a code type unavailable for the placement, or no invocation-code email template configured and no subject and body sent
- `401` — Authentication error
- `403` — No VIEW access to the site
- `404` — Site or placement not found or deleted

## Example request

```bash
curl --request POST \
  --url 'https://YOUR-NETWORK-DOMAIN/rest-api/sites/5001/invocation-codes/send.do' \
  --header 'X-Api-Key: YOUR_API_KEY' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'bccAuthor=false' \
  --data-urlencode 'body=<p>Tags for your site are attached.</p>' \
  --data-urlencode 'emails=publisher@example.com'
```

Source: https://epom.com/ad-server/docs/api/sites/post-sites-invocation-codes-send