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

# Finalizing an Invoice

Now that you've created an invoice draft, and your user has reviewed it, the time has come to finalize the invoice.

## 1. Finalizing a drafted invoice

You can finalize the invoice by making the following POST call:

```curl theme={null}
curl \
  --request POST \
  --url https://sandbox.hurdlr.com/rest/v5/invoicing/finalizeInvoice \
  --header 'Authorization: Bearer ${access_token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "id": 21850,
    "sendEmail": true
  }'
```

The `sendEmail` flag can be used to determine whether the invoice should be sent to the client or not. There are times where a user may want to simply create the invoice for internal tracking reasons, but not send the invoice to the client. The invoice can be sent at a later time, using the /sendInvoice endpoint.

The response will contain an `htmlReport` attribute, which contains an embeddable HTML body of the user's invoice, including their custom branding that you set up earlier:

```json theme={null}
{
    "result": "SUCCESS",
    "htmlReport": "<html> Your user's invoice draft's html </html>",
    "invoiceId": "21850",
}
```

You can parse out the `htmlReport` field and embed that in your product's UI for your user to review.

## 2. Sending an invoice to the client

If you opted to *not* send the invoice in the finalization step, you can simply make a POST call to the /sendInvoice endpoint to send the given invoice to the client:

```curl theme={null}
curl \
  --request POST \
  --url https://sandbox.hurdlr.com/rest/v5/invoicing/sendInvoice \
  --header 'Authorization: Bearer ${access_token}' \
  --header 'Content-Type: application/json' \
  --data '{
    "invoiceId": 21850
  }'
```

If you'd like these emails to originate from your own domain, simply email [api@tight.com](mailto:api@tight.com) and our API team will work with you to set that up.
