Get invoices¶
Get invoices for an organization
Prerequisites¶
Credentials as described in Authentication
An Organization identifier
C#¶
var client = new CrayonApiClient("https://api.crayon.com/");
var token = client.Tokens.GetUserToken(clientId, clientSecret, userName, password).GetData().AccessToken;
var result = await client.Invoices.GetAsync(token, organizationId, new InvoiceFilter());
Request¶
Request Syntax:
Method  | 
Request URI  | 
|---|---|
GET  | 
https://api.crayon.com/api/v1/invoices/{organizationId}?page=1&pageSize=50  | 
Request Parameters:
Name  | 
Type  | 
Required  | 
Description  | 
|---|---|---|---|
organizationId  | 
int  | 
Yes  | 
Identifier for an organization  | 
page  | 
int  | 
No  | 
Pagination, starts at page 1  | 
pageSize  | 
int  | 
No  | 
Pagination, Number of objects to return (default: 50)  | 
Request Headers:
The following HTTP request headers are supported
Header  | 
Type  | 
Description  | 
|---|---|---|
Authorization  | 
string  | 
Required. The authorization token in the form Bearer <token>.  | 
Accept  | 
string  | 
Specifies the response type, “application/json”  | 
Request Example:
GET $"https://api.crayon.com/api/v1/invoices/{organizationId}?page=1&pageSize=1"
Accept : application/json
Authorization : Bearer < Token >
Response¶
If successful, this method returns a collection of Invoices in the response body.
{
    "Items": [
        {
            "InvoiceId": "133252324",
            "OrderId": "7728322354",
            "SalesCurrencyCode": "USD",
            "SalesAmount": 1500.75,
            "InvoiceCustomerId": "CUST-001",
            "InvoiceCustomerName": "John Doe",
            "OrderCustomerId": "CUST-002",
            "OrderCustomerName": "Jane Smith",
            "CustomerReference": "REF-789",
            "CustomerRequisition": "REQ-456",
            "InvoiceDate": "2024-02-25T12:00:00Z"
        }
    ],
    "TotalHits": 99
}
Response success and error codes:
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters.
Error Codes  | 
Description  | 
|---|---|
200 OK  | 
The request has succeeded.  | 
401 Unauthorized  | 
The request requires user authentication. If the request already included Authorization credentials, then the 401 (Unauthorized) status code means that authorization has been refused for those credentials. It is a non-retryable error condition.  |