This API endpoint allows you to update an invoice. You can update the general ledger ID, approval status, and paid status.

When setting approved to true, the invoice will be marked as approved with the current timestamp and user. When setting approved to false, the approval information will be cleared.

The paid status can be toggled between true and false to reflect payment status.

Note: Invoices that are already paid or approved may have restrictions on what fields can be updated.

A successful request returns 200 OK with the updated invoice, as in the last example below. approved_by is the user that approved the invoice, which for approvals made through the API is your organization’s API user. A request that fails validation returns 422 with the errors.

Supported Formats

json

Errors

Code Description
404 Not found.
400 Invalid request.
500 Server crashed.

Examples

# Update all fields in a single request
curl "https://app.octopi.co/api/v1/invoices/353388.json" -X PUT -d '{ "invoice": { "general_ledger_id": "C8191", "approved": true, "paid": true } }' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
# Update only specific fields as needed
curl "https://app.octopi.co/api/v1/invoices/353388.json" -X PUT -d '{ "invoice": { "approved": true } }' -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Token token=YOUR TOKEN HERE"
{
   "invoice" : {
      "id" : "222",
      "number": "5",
      "general_ledger_id": "1231",
      "created_at": "2016-11-28T19:01:41.936-05:00",
      "invoiced_at": "2016-11-28T19:01:41.936-05:00",
      "approved": true,
      "approved_at": "2016-11-28T19:05:41.936-05:00",
      "approved_by": {
        "id": 4021,
        "created_at": "2020-08-04T07:56:04.939-04:00",
        "updated_at": "2022-03-28T11:11:59.496-04:00",
        "organization_id": 8,
        "agent_id": null,
        "shipping_line_id": null,
        "consignee_id": null,
        "email": "yourterminal@example.com",
        "firstname": "Octopi",
        "lastname": "System",
        "office_phone": null,
        "mobile_phone": null,
        "title": null,
        "address": null,
        "roles_users_count": 0,
        "work_location_type": null,
        "work_location_id": null,
        "trucking_company_id": null,
        "active": false,
        "is_equipment_operator": false,
        "high_contrast_ui": false,
        "freight_forwarder_id": null,
        "staff": false,
        "beta_tester": false,
        "locale": "en",
        "pending_approval": false,
        "broker_id": null,
        "enforce_mfa": false,
        "name": "Octopi System"
      },
      "paid": true,
      "total": 1231.00
   }
}

Params

Param name Description
id
required

Validations:

  • Must be a String

invoice
required

Validations:

  • Must be a Hash

invoice[general_ledger_id]
optional

The general ledger ID for the invoice

Validations:

  • Must be a String

invoice[approved]
optional

Set to true to approve the invoice, false to unapprove it

Validations:

  • Must be one of: true, false, 1, 0.

invoice[paid]
optional

Set to true to mark the invoice as paid, false to mark as unpaid

Validations:

  • Must be one of: true, false, 1, 0.