> ## Documentation Index
> Fetch the complete documentation index at: https://developers.mioesim.com/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /api_esim/handlerEsimPdf — Send PDF or get link

> Send an eSIM activation PDF to a customer email address, or retrieve a direct download URL. Supports targeting one or more specific ICCIDs within an order.

Use this endpoint to deliver eSIM activation PDFs to your customers. Pass `type=email` to send directly to an email address, or `type=link` to receive a download URL you can share however you like.

```
POST https://bpm.mioesim.com/api_esim/handlerEsimPdf
```

## Request parameters

<ParamField body="token" type="string" required>Session token.</ParamField>
<ParamField body="type" type="string" required>`"email"` = send to email address; `"link"` = return download URL.</ParamField>
<ParamField body="orderId" type="string" required>Order number.</ParamField>
<ParamField body="sign" type="string" required>Request signature.</ParamField>
<ParamField body="iccids" type="string">Specific ICCID(s) to include, comma-separated. Leave empty to include all cards in the order.</ParamField>
<ParamField body="email" type="string">Destination email address (required when `type=email`).</ParamField>
<ParamField body="saveType" type="integer">`1` = save this email address to the order (replaces existing). `0`/empty = don't save.</ParamField>

## Response

When `type=link`, `data` is a map of ICCID → PDF URL:

```json theme={null}
{
  "code": "0",
  "message": "Successful return of pdf link",
  "data": {
    "9000024041590216": "http://img.mioesim.com/phoneImage/202404//5072a173.pdf",
    "9000024041549678": "http://img.mioesim.com/phoneImage/202404//1852e23a.pdf"
  }
}
```

When `type=email`, `data` is `null` on success:

```json theme={null}
{ "code": "0", "message": "PDF has been sent to the email", "data": null }
```

## Example

<CodeGroup>
  ```bash Get PDF links theme={null}
  curl -X POST https://bpm.mioesim.com/api_esim/handlerEsimPdf \
    -d "token=YOUR_TOKEN" \
    -d "type=link" \
    -d "orderId=EP20240124000013" \
    -d "sign=YOUR_SIGN"
  ```

  ```bash Send to email theme={null}
  curl -X POST https://bpm.mioesim.com/api_esim/handlerEsimPdf \
    -d "token=YOUR_TOKEN" \
    -d "type=email" \
    -d "orderId=EP20240124000013" \
    -d "email=customer@example.com" \
    -d "sign=YOUR_SIGN"
  ```
</CodeGroup>

## Error codes

| Code  | Meaning                            |
| ----- | ---------------------------------- |
| `-1`  | Token expired                      |
| `-2`  | Required parameter missing         |
| `4`   | Order status abnormal              |
| `99`  | PDF generation or delivery failure |
| `-30` | Signature wrong                    |
