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

# Send Invoice

> Send an invoice to the customer via email

<Note>
  This endpoint sends an invoice to the customer via email. The invoice must be in draft or sent status.
</Note>

## Authentication

This endpoint requires a valid API key with `invoices:write` permissions.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier of the invoice to send
</ParamField>

## Request Body

<ParamField body="to" type="array">
  Email addresses to send to (defaults to customer email)
</ParamField>

<ParamField body="cc" type="array">
  CC email addresses
</ParamField>

<ParamField body="bcc" type="array">
  BCC email addresses
</ParamField>

<ParamField body="subject" type="string">
  Custom email subject (defaults to "Invoice \[number] from \[company]")
</ParamField>

<ParamField body="message" type="string">
  Custom email message
</ParamField>

<ParamField body="attach_pdf" type="boolean">
  Whether to attach PDF (default: true)
</ParamField>

### Response

Returns the sent invoice with email details.

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/invoices/inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30/send' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data-raw '{
      "cc": ["accounting@acme.com"],
      "message": "Please find attached invoice for January services. Let me know if you have any questions."
  }'
  ```

  ```javascript Node.js theme={null}
  const invoice = await stateset.invoices.send(
    'inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    {
      cc: ["accounting@acme.com"],
      message: "Please find attached invoice for January services. Let me know if you have any questions."
    }
  );
  ```

  ```python Python theme={null}
  invoice = stateset.invoices.send(
    'inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30',
    cc=["accounting@acme.com"],
    message="Please find attached invoice for January services. Let me know if you have any questions."
  )
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "inv_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
    "object": "invoice",
    "status": "sent",
    "sent_at": "2024-01-20T12:00:00Z",
    "email_details": {
      "sent_to": ["billing@acme.com"],
      "cc": ["accounting@acme.com"],
      "subject": "Invoice INV-2024-0001 from Stateset",
      "message": "Please find attached invoice for January services. Let me know if you have any questions.",
      "attachments": ["invoice_INV-2024-0001.pdf"]
    },
    "sent_count": 1,
    "last_sent_at": "2024-01-20T12:00:00Z",
    "next_reminder_date": "2024-01-27T12:00:00Z"
  }
  ```
</ResponseExample>
