Invoice API Reference

This documentation provides detailed information, examples, and best practices for effectively utilizing the Invoice model. Discover how to create, retrieve, update, and manage invoices effortlessly. Explore the powerful API endpoints and data structures available, empowering you to seamlessly handle invoices within your system. Enhance your invoicing workflow and streamline financial processes by leveraging our Invoice API.

The Invoice model

Invoices are documents that outline the costs of products or services provided by a business. They include details like item descriptions, quantities, prices, and total amounts. Invoices are crucial for transparent transactions, helping businesses and customers keep track of financial dealings.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the invoice.

  • Name
    invoice_date
    Type
    timestamp
    Description

    Date of the invoice.

  • Name
    created_at
    Type
    timestamp
    Description

    Date of creation.

  • Name
    due_date
    Type
    timestamp
    Description

    Due Date.

  • Name
    invoice_number
    Type
    string
    Description

    Invoice Number.

  • Name
    status
    Type
    string
    Description

    Status of the invoice.

  • Name
    paid_status
    Type
    string
    Description

    Paid status of the invoice.

  • Name
    reject_reason
    Type
    string
    Description

    Reason for rejection.

  • Name
    notes
    Type
    string
    Description

    Invoice Notes.

  • Name
    discount_type
    Type
    string
    Description

    Type of discount: fixed or percentage.

  • Name
    discount
    Type
    integer
    Description

    Discount value.

  • Name
    discount_val
    Type
    integer
    Description

    Discount value in cents.

  • Name
    sub_total
    Type
    integer
    Description

    Subtotal in cents.

  • Name
    tax
    Type
    integer
    Description

    Tax in cents.

  • Name
    total
    Type
    integer
    Description

    Total in cents.

  • Name
    due_amount
    Type
    integer
    Description

    Due amount in cents.

  • Name
    sent_at
    Type
    timestamp
    Description

    Date of sending.

  • Name
    viewed_at
    Type
    timestamp
    Description

    Date of viewing.

  • Name
    overdue_at
    Type
    timestamp
    Description

    Date of overdue.

  • Name
    template_name
    Type
    string
    Description

    Name of the template to be used for the invoice PDF.

  • Name
    sequence_number
    Type
    integer
    Description

    Sequence number.

  • Name
    customer_id
    Type
    string
    Description

    Customer ID.

  • Name
    invoice_pdf_url
    Type
    string
    Description

    URL of the invoice PDF.

  • Name
    attachments
    Type
    array
    Description

    Array of attachments.

  • Name
    invoice_type
    Type
    string
    Description

    Type of invoice.

  • Name
    payee_loan_status
    Type
    string
    Description

    Payee loan status.

  • Name
    payor_loan_status
    Type
    string
    Description

    Payor loan status.

  • Name
    tax_per_item_enabled
    Type
    boolean
    Description

    Tax per item enabled.

  • Name
    discount_per_item_enabled
    Type
    boolean
    Description

    Discount per item enabled.


GETapi/v2/invoices/templates

List all invoice templates

This endpoint returns a list invoice templates.

Request

GET
api/v2/invoices/templates
curl --request GET \
  --get "https://payments.your-domain.com/api/v2/invoices/templates" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "invoiceTemplates": [
    {
      "name": "invoice1",
      "path": "/templates/invoice1.png"
    },
    {
      "name": "invoice2",
      "path": "/templates/invoice2.png"
    },
    {
      "name": "invoice3",
      "path": "/templates/invoice3.png"
    }
  ]
}

GETapi/v2/invoices

List all invoices

This endpoint allows you to retrieve a paginated list of all your invoices.

Parameters

  • Name
    limit
    Type
    integer
    Description

    Limit the number of invoices to be returned.

  • Name
    page
    Type
    integer
    Description

    Page number (for pagination).

  • Name
    status
    Type
    string
    Description

    Filter records by status.

  • Name
    customer_id
    Type
    string
    Description

    Filter records by customer_id.

  • Name
    invoice_number
    Type
    integer
    Description

    Filter records by invoice_number .

  • Name
    from_date
    Type
    string
    Description

    Filter records by from_date.

  • Name
    to_date
    Type
    string
    Description

    Filter records by to_date.

Request

GET
api/v2/invoices
curl --request GET \
  --get "https://payments.your-domain.com/api/v2/invoices" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "data": [
    {
      "id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
      "estimate_id" : null,
      "invoice_date" : 1017705600,
      "created_at" : 1687252082,
      "due_date" : 1594944000,
      "invoice_number" : "INV-000001",
      "status" : "DRAFT",
      "paid_status" : "UNPAID",
      "reject_reason" : null,
      "notes" : "<p>The total amount of the attached invoice INV-000001 is $190.00</p>",
      "notes_raw" : "<p>The total amount of the attached invoice {INVOICE_NUMBER} is {TOTAL_AMOUNT}</p>",
      "discount_type" : "percentage",
      "discount" : 5,
      "discount_val" : 1000,
      "sub_total" : 20000,
      "tax" : 0,
      "total" : 19000,
      "due_amount" : 19000,
      "sent_at" : null,
      "viewed_at" : null,
      "overdue_at" : null,
      "template_name" : "invoice1",
      "sequence_number" : 1,
      "customer_id" : "9974661a-25f6-4389-80bd-a62de5220f43",
      "invoice_pdf_url" : "https://payments.your-domain.com/invoices/pdf/9aae0110-a4d6-4552-99de-4b4d3e3432f8",
      "attachments" : [],
      "invoice_type" : "outgoing",
      "payee_loan_status" : "DRAFT",
      "payor_loan_status" : "DRAFT",
      "tax_per_item_enabled" : false,
      "discount_per_item_enabled" : false,
      "scheduled_date": null,
      "customer" : {},
      "invoice_status_allowed_states": [
        "SENT"
      ],
      "invoice_paid_status_allowed_states": [
        "PARTIALLY_PAID",
        "PAID"
      ],
      "allow_edit": true
    }
  ]
}

POSTapi/v2/invoices

Create an invoice

This endpoint allows you to create an invoice.

Parameters

  • Name
    invoice_date
    Type
    timestamp
    Description

    Date of the invoice.

  • Name
    due_date
    Type
    timestamp
    Description

    Due Date.

  • Name
    customer_id
    Type
    string
    Description

    Customer ID.

  • Name
    tax_type_ids
    Type
    array
    Description

    Array of Tax type IDs.

  • Name
    invoice_number
    Type
    string
    Description

    Invoice Number.

  • Name
    notes
    Type
    string
    Description

    Invoice Notes.

  • Name
    discount_type
    Type
    string
    Description

    Type of discount: fixed or percentage.

  • Name
    discount
    Type
    integer
    Description

    Discount value. Pass percentage of the discount or the amount if the discount is fixed in cents. Example: 10 (percentage) or 1000(fixed).

  • Name
    template_name
    Type
    string
    Description

    Name of the template to be used for the invoice PDF.

  • Name
    items[].name
    Type
    string
    Description

    Name of Item.

  • Name
    items[].quantity
    Type
    integer
    Description

    Item Quantity.

  • Name
    items[].price
    Type
    integer
    Description

    Item Price in cents.

  • Name
    items[].description
    Type
    string
    Description

    Item Description.

  • Name
    items[].item_id
    Type
    string
    Description

    Item ID.

  • Name
    items[].unit_name
    Type
    string
    Description

    Item Unit Name.

  • Name
    items[].discount
    Type
    integer
    Description

    Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

  • Name
    items[].discount_type
    Type
    string
    Description

    Type of discount: fixed or percentage.

  • Name
    items[].tax_type_ids
    Type
    array
    Description

    Array of Tax type IDs.

Request

POST
api/v2/invoices
curl --request POST \
  "https://payments.your-domain.com/api/v2/invoices" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d" \
  --data "{
    \"invoice_number\": \"INV-000001\",
    \"invoice_date\": \"1017705600\",
    \"due_date\": \"1594944000\",
    \"customer_id\": \"98ed68ce-6964-4c2a-9430-8a849e373c52\",
    \"discount_type\": \"percentage\",
    \"discount\": \"5\",
    \"notes\": \"<p>The total amount of the attached invoice {INVOICE_NUMBER} is {TOTAL_AMOUNT}</p>\",
    \"template_name\": \"invoice1\",
    \"items\": [
      {
        \"name\": \"Laptop\",
        \"quantity\": \"2\",
        \"price\": \"10000\",
        \"description\": \"New Laptop with latest features\",
        \"item_id\": \"9911d6af-02ee-40dd-b8da-95df7301bd18\",
        \"unit_name\": \"box\",
        \"discount\": \"0\",
        \"discount_type\": \"fixed\"
      }
    ]
  }"

Response

{
  "data" : {
    "id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
    "estimate_id": null,
    "invoice_date" : 1017705600,
    "created_at" : 1687268840,
    "due_date" : 1594944000,
    "invoice_number" : "INV-000001",
    "status" : "DRAFT",
    "paid_status" : "UNPAID",
    "reject_reason" : null,
    "notes" : "<p>The total amount of the attached invoice INV-000001 is $190.00</p>",
    "notes_raw" : "<p>The total amount of the attached invoice {INVOICE_NUMBER} is {TOTAL_AMOUNT}</p>",
    "discount_type" : "percentage",
    "discount" : 5,
    "discount_val" : 1000,
    "sub_total" : 20000,
    "tax" : 0,
    "total" : 19000,
    "due_amount" : 19000,
    "sent_at" : null,
    "viewed_at" : null,
    "overdue_at" : null,
    "template_name" : "invoice1",
    "sequence_number" : 1,
    "customer_id" : "98ed68ce-6964-4c2a-9430-8a849e373c52",
    "invoice_pdf_url" : "https://payments.your-domain.com/invoices/pdf/9aae0110-a4d6-4552-99de-4b4d3e3432f8",
    "attachments" : [],
    "invoice_type" : "outgoing",
    "payee_loan_status" : "DRAFT",
    "payor_loan_status" : "DRAFT",
    "tax_per_item_enabled" : false,
    "discount_per_item_enabled" : false,
    "scheduled_date": null,
    "items" : [
      {
        "id" : "9974c9fc-5dfc-4262-81b8-f42e3275119b",
        "name" : "Laptop",
        "description" : "New Laptop with latest features",
        "discount_type" : null,
        "price" : 10000,
        "quantity" : 2,
        "unit_name" : null,
        "discount" : 0,
        "discount_val" : 0,
        "tax" : 0,
        "total" : 20000,
        "invoice_id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
        "item_id" : "9911d6af-02ee-40dd-b8da-95df7301bd18",
        "business_id" : "995c98ce-cdd9-4ef6-b018-9c696cb07e9d"
      }
    ],
    "customer" : {},
    "business" : {},
    "invoice_status_allowed_states": [
      "SENT"
    ],
    "invoice_paid_status_allowed_states": [
      "PARTIALLY_PAID",
      "PAID"
    ],
    "allow_edit": true
  }
}

GETapi/v2/invoices/{id}

Retrieve an invoice

This endpoint allows you to retrieve an invoice.

Parameters

  • Name
    id
    Type
    integer
    Description

    The ID of the invoice.

Request

GET
api/v2/invoices/{id}
curl --request GET \
  --get "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "data" : {
    "id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
    "estimate_id" : null,
    "invoice_date" : 1017705600,
    "created_at" : 1687268840,
    "due_date" : 1594944000,
    "invoice_number" : "INV-000001",
    "status" : "DRAFT",
    "paid_status" : "UNPAID",
    "reject_reason" : null,
    "notes" : "<p>The total amount of the attached invoice INV-000001 is $190.00</p>",
    "notes_raw" : "<p>The total amount of the attached invoice {INVOICE_NUMBER} is {TOTAL_AMOUNT}</p>",
    "discount_type" : "percentage",
    "discount" : 5,
    "discount_val" : 1000,
    "sub_total" : 20000,
    "tax" : 0,
    "total" : 19000,
    "due_amount" : 19000,
    "sent_at" : null,
    "viewed_at" : null,
    "overdue_at" : null,
    "template_name" : "invoice1",
    "sequence_number" : 1,
    "customer_id" : "98ed68ce-6964-4c2a-9430-8a849e373c52",
    "invoice_pdf_url" : "https://payments.your-domain.com/invoices/pdf/9aae0110-a4d6-4552-99de-4b4d3e3432f8",
    "attachments" : [],
    "invoice_type" : "outgoing",
    "payee_loan_status" : "DRAFT",
    "payor_loan_status" : "DRAFT",
    "tax_per_item_enabled" : false,
    "discount_per_item_enabled" : false,
    "scheduled_date": null,
    "items" : [
      {
        "id" : "9974c9fc-5dfc-4262-81b8-f42e3275119b",
        "name" : "Laptop",
        "description" : "New Laptop with latest features",
        "discount_type" : null,
        "price" : 10000,
        "quantity" : 2,
        "unit_name" : null,
        "discount" : 0,
        "discount_val" : 0,
        "tax" : 0,
        "total" : 20000,
        "invoice_id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
        "item_id" : "9911d6af-02ee-40dd-b8da-95df7301bd18",
        "business_id" : "995c98ce-cdd9-4ef6-b018-9c696cb07e9d"
      }
    ],
    "customer" : {},
    "business" : {},
    "invoice_status_allowed_states": [
      "SENT"
    ],
    "invoice_paid_status_allowed_states": [
      "PARTIALLY_PAID",
      "PAID"
    ],
    "allow_edit": true
  }
}

PUTapi/v2/invoices/{id}

Update an invoice

This endpoint allows you to perform an update on invoice.

Parameters

  • Name
    id
    Type
    string
    Description

    The ID of the invoice.

Parameters

  • Name
    invoice_date
    Type
    timestamp
    Description

    Date of the invoice.

  • Name
    due_date
    Type
    timestamp
    Description

    Due Date.

  • Name
    customer_id
    Type
    string
    Description

    Customer ID.

  • Name
    tax_type_ids
    Type
    array
    Description

    Array of Tax type IDs.

  • Name
    invoice_number
    Type
    string
    Description

    Invoice Number.

  • Name
    notes
    Type
    string
    Description

    Invoice Notes.

  • Name
    discount_type
    Type
    string
    Description

    Type of discount: fixed or percentage.

  • Name
    discount
    Type
    integer
    Description

    Discount value. Pass percentage of the discount or the amount if the discount is fixed in cents. Example: 10 (percentage) or 1000(fixed).

  • Name
    template_name
    Type
    string
    Description

    Name of the template to be used for the invoice PDF.

  • Name
    items[].name
    Type
    string
    Description

    Name of Item.

  • Name
    items[].quantity
    Type
    integer
    Description

    Item Quantity.

  • Name
    items[].price
    Type
    integer
    Description

    Item Price in cents.

  • Name
    items[].description
    Type
    string
    Description

    Item Description.

  • Name
    items[].item_id
    Type
    string
    Description

    Item ID.

  • Name
    items[].unit_name
    Type
    string
    Description

    Item Unit Name.

  • Name
    items[].discount
    Type
    integer
    Description

    Actual discount value that appears on the PDF. Pass percentage of the discount or the amount if the discount is fixed.

  • Name
    items[].discount_type
    Type
    string
    Description

    Type of discount: fixed or percentage.

  • Name
    items[].tax_type_ids
    Type
    array
    Description

    Array of Tax type IDs.

Request

PUT
api/v2/invoices/{id}
curl --request PUT \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d" \
  --data "{
    \"invoice_number\": \"INV-000001\",
    \"invoice_date\": \"1017705600\",
    \"due_date\": \"1594944000\",
    \"customer_id\": \"98ed68ce-6964-4c2a-9430-8a849e373c52\",
    \"discount_type\": \"percentage\",
    \"discount\": \"5\",
    \"notes\": \"<p>The total amount of the attached invoice {INVOICE_NUMBER} is {TOTAL_AMOUNT}</p>\",
    \"template_name\": \"invoice1\",
    \"items\": [
      {
        \"name\": \"Apple Macbook\",
        \"quantity\": \"2\",
        \"price\": \"10000\",
        \"description\": \"Light and powerful laptop\",
        \"unit_name\": \"box\",
        \"discount\": \"0\",
        \"discount_type\": \"fixed\"
      }
    ]
  }"

Response

{
  "data" : {
    "id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
    "estimate_id" : null,
    "invoice_date" : 1017705600,
    "created_at" : 1687268840,
    "due_date" : 1594944000,
    "invoice_number" : "INV-000001",
    "status" : "DRAFT",
    "paid_status" : "UNPAID",
    "reject_reason" : null,
    "notes" : "<p>The total amount of the attached invoice INV-000001 is $190.00</p>",
    "notes_raw" : "<p>The total amount of the attached invoice {INVOICE_NUMBER} is {TOTAL_AMOUNT}</p>",
    "discount_type" : "percentage",
    "discount" : 5,
    "discount_val" : 1000,
    "sub_total" : 20000,
    "tax" : 0,
    "total" : 19000,
    "due_amount" : 19000,
    "sent_at" : null,
    "viewed_at" : null,
    "overdue_at" : null,
    "template_name" : "invoice1",
    "sequence_number" : 1,
    "customer_id" : "98ed68ce-6964-4c2a-9430-8a849e373c52",
    "invoice_pdf_url" : "https://payments.your-domain.com/invoices/pdf/9aae0110-a4d6-4552-99de-4b4d3e3432f8",
    "attachments" : [],
    "invoice_type" : "outgoing",
    "payee_loan_status" : "DRAFT",
    "payor_loan_status" : "DRAFT",
    "tax_per_item_enabled" : false,
    "discount_per_item_enabled" : false,
    "scheduled_date": null,
    "items" : [
      {
        "id" : "9974c9fc-5dfc-4262-81b8-f42e3275119b",
        "name" : "Apple Macbook",
        "description" : "Light and powerful laptop",
        "discount_type" : null,
        "price" : 10000,
        "quantity" : 2,
        "unit_name" : null,
        "discount" : 0,
        "discount_val" : 0,
        "tax" : 0,
        "total" : 20000,
        "invoice_id" : "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
        "item_id" : null,
        "business_id" : "995c98ce-cdd9-4ef6-b018-9c696cb07e9d"
      }
    ],
    "customer" : {},
    "business" : {},
    "invoice_status_allowed_states": [
        "SENT"
    ],
    "invoice_paid_status_allowed_states": [
        "PARTIALLY_PAID",
        "PAID"
    ],
    "allow_edit": true
  }
}

DELETEapi/v2/invoices/{id}

Delete invoice

This endpoint allows you to delete a specific invoice.

Parameters

  • Name
    id
    Type
    integer
    Description

    The ID of the invoice.

Request

DELETE
api/v2/invoices/{id}
curl --request DELETE \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "id": "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
  "object": "Invoice",
  "deleted": true
}

POSTapi/v2/invoices/{id}/send-email

Send an invoice

This endpoint allows you to send the invoice link to the corresponding customer's email address.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

Parameters

  • Name
    subject
    Type
    string
    Description
  • Name
    body
    Type
    string
    Description
  • Name
    reply_to
    Type
    string
    Description
  • Name
    to
    Type
    string
    Description

Request

POST
api/v2/invoices/{id}/send-email
curl --request POST \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/send-email" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d" \
  --data "{
    \"body\": \"<p>You have received a new invoice from {BUSINESS_NAME}.</p><p>Please view the invoice and approve it within 7 days of receiving this email.</p>\",
    \"subject\": \"You have received a new invoice from {VENDOR_BUSINESS_NAME}\",
    \"reply_to\": \"business_email@example.com\",
    \"to\": \"customer_email@example.com\"
  }"

POSTapi/v2/invoices/{id}/clone

Clone an invoice

This endpoint allows you to clone invoice.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

Request

POST
api/v2/invoices/{id}/clone
curl --request POST \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/clone" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

POSTapi/v2/invoices/{id}/approve

Approve an incoming invoice

This endpoint allows you mark an invoice as APPROVED.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

Request

POST
api/v2/invoices/{id}/approve
curl --request POST \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/approve" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 98ed68ce-6964-4c2a-9430-8a849e373c52"

POSTapi/v2/invoices/{id}/reject

Reject an incoming invoice.

This endpoint allows you mark an invoice as REJECTED.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

Parameters

  • Name
    reason
    Type
    string
    Description

    Reason for rejecting the invoice.

Request

POST
api/v2/invoices/{id}
curl --request POST \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/reject" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 98ed68ce-6964-4c2a-9430-8a849e373c52" \
  --data "{
    \"reason\": \"I don't wish to pay the invoice.\"
  }"

GETapi/v2/invoices/{id}/attachments

List all attachment of an invoice

This endpoint is used to get all attachments of an invoice.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

Request

GET
api/v2/invoices/{id}/attachments
curl --request GET \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/attachments" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "data": [
    {
      "id": 17,
      "invoice_id": "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
      "name": "logo-dark",
      "path": null,
      "url": null,
      "size": 151922,
      "mime_type": "image/png"
    }
  ]
}

POSTapi/v2/invoices/{id}/attachments

Add attachment to an invoice

This endpoint is used to upload an attachments to an invoice.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

Request

POST
api/v2/invoices/{id}/attachments
curl --request POST \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/attachments" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: multipart/form-data" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d" \
  --form 'file=@"/path_to_attachment/crater_attachment.png"'

Response

{
  "data": [
    {
      "id": 17,
      "invoice_id": "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
      "name": "crater_attachment.png",
      "path": null,
      "url": null,
      "size": 151922,
      "mime_type": "image/png"
    }
  ]
}

GETapi/v2/invoices/{id}/attachments/{attachment_id}

Retrieve attachment of an invoice

This endpoint is used to get all attachments of an invoice.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

  • Name
    attachment_id
    Type
    integer
    Description

    The ID of the attachment.

Request

GET
api/v2/invoices/{id}/attachments/{attachment_id}
curl --request GET \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/attachments/17" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "data": [
    {
      "id": 17,
      "invoice_id": "9aae0110-a4d6-4552-99de-4b4d3e3432f8",
      "name": "logo-dark",
      "path": null,
      "url": null,
      "size": 151922,
      "mime_type": "image/png"
    }
  ]
}

DELETEapi/v2/invoices/{id}/attachments/{attachment_id}

Remove attachment from an invoice

This endpoint is used to remove attachment from invoice.

Parameters

  • Name
    invoice_id
    Type
    integer
    Description

    The ID of the invoice.

  • Name
    attachment_id
    Type
    integer
    Description

    The ID of the attachment.

Request

DELETE
api/v2/invoices/{id}/attachments/{attachment_id}
curl --request DELETE \
  "https://payments.your-domain.com/api/v2/invoices/9aae0110-a4d6-4552-99de-4b4d3e3432f8/attachments/17" \
  --header "Authorization: Bearer {YOUR_AUTH_TOKEN}" \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "business: 995c98ce-cdd9-4ef6-b018-9c696cb07e9d"

Response

{
  "id" : 17,
  "object": "Attachment",
  "deleted" : true,
}