Happy Business Starts Here

REST API Endpoint for Invoice Retrieval by InvoiceNumber

REST API Endpoint for Invoice Retrieval by InvoiceNumber

There is a deficiency in the Orders creation endpoint where the response returned from the creation does not contain Invoice IDs, only Invoice Numbers (see below). The problem with that, is there is no REST endpoint that allows us to look up an Invoice by InvoiceNumber.


    "success": true,
    "orderNumber": "O-00000014",
    "accountNumber": "A00000001",
    "status": "Completed",
    "subscriptionNumbers": [
    "invoiceNumbers": [
    "paymentNumber": "P-00000001",
    "paidAmount": 5.03

By not providing an endpoint to look up an Invoice by InvoiceNumber, we're forced to execute a ZOQL query to retrieve invoice data, but we cannot readily model our data consistently as we would be able to if there was a REST endpoint that provided an Invoice object, just looked up by InvoiceNumber instead of Id.


We propose either of the following solutions:

  1. Creation of an additional REST API endpoint that will retrieve an Invoice object by InvoiceNumber
  2. Provide the Invoice ID (not just Number) back in the payload of the Order Creation response.
1 Comment
Savvy Scholar

I've been running in to many issues in a similar vein to this. To get around some of the API shortcomings I've been using the Query endpoint to fill the gaps.


In this case, a payload of

    "queryString": "select Id, from Invoice where InvoiceNumber = 'INV00000003'"

would give you what you need to continue with your operations. Alternatively you could just query for all the invoice information you need if you're not then making subsequent requests.