Create an invoice

Changed on

Create an invoice and email it to the customer, or schedule it with scheduledSendDate. See Create an invoice.

post/v2/invoices

Request

  • Base URL
    https://api.slash.com
  • URL
    https://api.slash.com/v2/invoices
  • Auth
    API key in header X-API-Key

Headers

X-Idempotency-Keystring required

Unique caller-generated key for one create request. Once an authenticated, schema-valid request reaches the operation, the key is permanently consumed for that operation and legal entity whether the operation succeeds or fails. Reusing it in that scope returns 409 and never replays a response, unlike API v1, which replays the original response for a matching key.

Request body

customerIdstring required

Customer id with the le_cus_ prefix.

accountIdstring

The account payments settle into, with the sa_group_ prefix. Required when the legal entity has more than one account that can receive payments.

virtualAccountIdstring

A virtual account to settle into instead of the account's primary one, with the subaccount_ prefix.

numberstring

Uppercase letters, digits, dashes and underscores. Defaults to the next number in your invoice settings.

issueDatestring date required
dueDatestring date required

On or after issueDate.

timezonestring required

The IANA timezone the invoice's dates are in.

scheduledSendDatestring date

Email the invoice at 9:00 on this day in timezone instead of now. The invoice stays scheduled until then.

taxRatenumber

Tax as a percent of the subtotal after the discount. 8.5 means 8.5%.

memostring

A note printed on the invoice.

ccEmailsstring[]

Also copied on the invoice and its reminders.

Example request

{
  "number": "INV-1042",
  "timezone": "America/New_York",
  "lineItems": [
    {
      "name": "Robot arm maintenance",
      "quantity": 2,
      "unitAmount": {
        "amount": 45000
      }
    }
  ],
  "discount": {
    "percent": 10
  }
}

Response

The created invoice.

idstring required

Invoice id with the inv_ prefix.

numberstring required

Unique per legal entity.

status'scheduled' | 'unpaid' | 'partially_paid' | 'paid' | 'void' required

See Invoice lifecycle.

overdueboolean required

Whether the invoice is unpaid or partially_paid and its due date has passed in its timezone.

customerIdstring

Customer id with the le_cus_ prefix.

accountIdstring required

The account payments settle into, with the sa_group_ prefix.

virtualAccountIdstring

The virtual account payments settle into, with the subaccount_ prefix. Absent when they settle into the account's primary virtual account.

seriesIdstring

The recurring series that issued the invoice, with the inv_series_ prefix.

issueDatestring date required
dueDatestring date required
timezonestring required

The IANA timezone the invoice's dates are in.

scheduledSendDatestring date

When a scheduled invoice will be emailed, at 9:00 in its timezone.

taxRatenumber

Tax as a percent of the subtotal after the discount. 8.5 means 8.5%.

memostring

A note printed on the invoice.

ccEmailsstring[] required

Also copied on the invoice and its reminders.

payUrlstring required

The hosted page where the customer views and pays the invoice.

documentIdstring required

The invoice's PDF, with the st_ prefix. Download it with GET /v2/documents/{documentId}. Each edit issues a new PDF.

nextReminderAtstring date-time

When the next automatic reminder is due to go out.

paidAtstring date-time

When the invoice became paid.

voidedAtstring date-time

When the invoice was voided.

createdAtstring date-time required

Example response

{
  "id": "inv_2rj4l7hmrrrcv",
  "number": "INV-1042",
  "customerId": "le_cus_2rj4l7hmrrrcv",
  "accountId": "sa_group_2rj4l7hmrrrcv",
  "timezone": "America/New_York",
  "lineItems": [
    {
      "name": "Robot arm maintenance",
      "quantity": 2
    }
  ],
  "discount": {
    "percent": 10
  },
  "taxRate": 8.5,
  "payments": [
    {
      "id": "inv_tr_link_2rj4l7hmrrrcv",
      "transactionId": "agg_tx_2rj4l7hmrrrcv"
    }
  ],
  "documentId": "st_2rj4l7hmrrrcv"
}

Changes