All URIs are relative to https://api.sbx.avalara.com/einvoicing
Method | HTTP request | Description |
---|---|---|
DownloadDocument | GET /documents/{documentId}/$download | Returns a copy of the document |
GetDocumentList | GET /documents | Returns a summary of documents for a date range |
GetDocumentStatus | GET /document/{documentId}/status | Checks the status of a document |
SubmitDocument | POST /documents | Submits a document to Avalara E-Invoicing API |
FileParameter DownloadDocument (DownloadDocumentRequest requestParameters)
Returns a copy of the document
When the document is available, use this endpoint to download it as text, XML, or PDF. The output format needs to be specified in the Accept header and it will vary depending on the mandate. If the file has not yet been created, then status code 404 (not found) is returned.
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Avalara.SDK.Api.EInvoicing.V1;
using Avalara.SDK.Client;
using Avalara.SDK.Model.EInvoicing.V1;
namespace Example
{
public class DownloadDocumentExample
{
public static void Main()
{
Configuration config = new Configuration();
config.Environment = AvalaraEnvironment.Sandbox;
config.BearerToken = "<Your Bearer Token>";
ApiClient apiClient= new ApiClient(config);
var apiInstance = new DocumentsApi(apiClient);
var requestParameters = new DownloadDocumentRequest();
requestParameters.AvalaraVersion = 1.0; // string | The HTTP Header meant to specify the version of the API intended to be used
requestParameters.Accept = application/pdf; // string | This header indicates the MIME type of the document
requestParameters.DocumentId = "documentId_example"; // string | The unique ID for this document that was returned in the POST /einvoicing/document response body
requestParameters.XAvalaraClient = John's E-Invoicing-API Client; // string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a \"Fingerprint\" (optional)
try
{
// Returns a copy of the document
FileParameter result = apiInstance.DownloadDocument(requestParameters);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DocumentsApi.DownloadDocument: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
AvalaraVersion | string | The HTTP Header meant to specify the version of the API intended to be used | |
Accept | string | This header indicates the MIME type of the document | |
DocumentId | string | The unique ID for this document that was returned in the POST /einvoicing/document response body | |
XAvalaraClient | string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a "Fingerprint" | [optional] |
- Content-Type: Not defined
- Accept: application/pdf, application/xml, application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | * Content-type - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | A document for the specified ID was not found. | - |
406 | Unsupported document format was requested in the Accept header | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DocumentListResponse GetDocumentList (GetDocumentListRequest requestParameters)
Returns a summary of documents for a date range
Get a list of documents on the Avalara E-Invoicing platform that have a processing date within the specified date range.
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Avalara.SDK.Api.EInvoicing.V1;
using Avalara.SDK.Client;
using Avalara.SDK.Model.EInvoicing.V1;
namespace Example
{
public class GetDocumentListExample
{
public static void Main()
{
Configuration config = new Configuration();
config.Environment = AvalaraEnvironment.Sandbox;
config.BearerToken = "<Your Bearer Token>";
ApiClient apiClient= new ApiClient(config);
var apiInstance = new DocumentsApi(apiClient);
var requestParameters = new GetDocumentListRequest();
requestParameters.AvalaraVersion = 1.0; // string | The HTTP Header meant to specify the version of the API intended to be used
requestParameters.XAvalaraClient = John's E-Invoicing-API Client; // string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a \"Fingerprint\" (optional)
requestParameters.StartDate = DateTime.Parse("2013-10-20T19:20:30+01:00"); // DateTime? | Start date of documents to return. This defaults to the previous month. (optional)
requestParameters.EndDate = DateTime.Parse("2013-10-20T19:20:30+01:00"); // DateTime? | End date of documents to return. This defaults to the current date. (optional)
requestParameters.Flow = out; // string | Optionally filter by document direction, where issued = `out` and received = `in` (optional)
requestParameters.Count = true; // string | When set to true, the count of the collection is also returned in the response body (optional)
requestParameters.CountOnly = false; // string | When set to true, only the count of the collection is returned (optional)
requestParameters.Filter = id eq 2023-02-000016; // string | Filter by field name and value. This filter only supports <code>eq</code> . Refer to [https://developer.avalara.com/avatax/filtering-in-rest/](https://developer.avalara.com/avatax/filtering-in-rest/) for more information on filtering. Filtering will be done over the provided startDate and endDate. If no startDate or endDate is provided, defaults will be assumed. (optional)
requestParameters.Top = 10; // decimal? | If nonzero, return no more than this number of results. Used with <code>$skip</code> to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 200 records. (optional)
requestParameters.Skip = 10; // string | If nonzero, skip this number of results before returning data. Used with <code>$top</code> to provide pagination for large datasets. (optional)
try
{
// Returns a summary of documents for a date range
DocumentListResponse result = apiInstance.GetDocumentList(requestParameters);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DocumentsApi.GetDocumentList: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
AvalaraVersion | string | The HTTP Header meant to specify the version of the API intended to be used | |
XAvalaraClient | string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a "Fingerprint" | [optional] |
StartDate | DateTime? | Start date of documents to return. This defaults to the previous month. | [optional] |
EndDate | DateTime? | End date of documents to return. This defaults to the current date. | [optional] |
Flow | string | Optionally filter by document direction, where issued = `out` and received = `in` | [optional] |
Count | string | When set to true, the count of the collection is also returned in the response body | [optional] |
CountOnly | string | When set to true, only the count of the collection is returned | [optional] |
Filter | string | Filter by field name and value. This filter only supports <code>eq</code> . Refer to https://developer.avalara.com/avatax/filtering-in-rest/ for more information on filtering. Filtering will be done over the provided startDate and endDate. If no startDate or endDate is provided, defaults will be assumed. | [optional] |
Top | decimal? | If nonzero, return no more than this number of results. Used with <code>$skip</code> to provide pagination for large datasets. Unless otherwise specified, the maximum number of records that can be returned from an API call is 200 records. | [optional] |
Skip | string | If nonzero, skip this number of results before returning data. Used with <code>$top</code> to provide pagination for large datasets. | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
400 | Bad request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DocumentStatusResponse GetDocumentStatus (GetDocumentStatusRequest requestParameters)
Checks the status of a document
Using the unique ID from POST /einvoicing/documents response body, request the current status of a document.
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Avalara.SDK.Api.EInvoicing.V1;
using Avalara.SDK.Client;
using Avalara.SDK.Model.EInvoicing.V1;
namespace Example
{
public class GetDocumentStatusExample
{
public static void Main()
{
Configuration config = new Configuration();
config.Environment = AvalaraEnvironment.Sandbox;
config.BearerToken = "<Your Bearer Token>";
ApiClient apiClient= new ApiClient(config);
var apiInstance = new DocumentsApi(apiClient);
var requestParameters = new GetDocumentStatusRequest();
requestParameters.AvalaraVersion = 1.0; // string | The HTTP Header meant to specify the version of the API intended to be used
requestParameters.DocumentId = "documentId_example"; // string | The unique ID for this document that was returned in the POST /einvoicing/documents response body
requestParameters.XAvalaraClient = John's E-Invoicing-API Client; // string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a \"Fingerprint\" (optional)
try
{
// Checks the status of a document
DocumentStatusResponse result = apiInstance.GetDocumentStatus(requestParameters);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DocumentsApi.GetDocumentStatus: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
AvalaraVersion | string | The HTTP Header meant to specify the version of the API intended to be used | |
DocumentId | string | The unique ID for this document that was returned in the POST /einvoicing/documents response body | |
XAvalaraClient | string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a "Fingerprint" | [optional] |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | OK | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | A document for the specified ID was not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DocumentSubmitResponse SubmitDocument (SubmitDocumentRequest requestParameters)
Submits a document to Avalara E-Invoicing API
For both e-invoices and credit notes, when a document is sent to this endpoint, it generates an invoice or credit note in the required format as mandated by the specified country. Additionally, it initiates the workflow to transmit the generated document to the relevant tax authority, if necessary.
The response from the endpoint contains a unique document ID, which can be used to request the status of the document and verify if it was successfully accepted at the destination.
Furthermore, the unique ID enables the download of a copy of the e-invoice or credit note for reference purposes.
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using Avalara.SDK.Api.EInvoicing.V1;
using Avalara.SDK.Client;
using Avalara.SDK.Model.EInvoicing.V1;
namespace Example
{
public class SubmitDocumentExample
{
public static void Main()
{
Configuration config = new Configuration();
config.Environment = AvalaraEnvironment.Sandbox;
config.BearerToken = "<Your Bearer Token>";
ApiClient apiClient= new ApiClient(config);
var apiInstance = new DocumentsApi(apiClient);
var requestParameters = new SubmitDocumentRequest();
requestParameters.AvalaraVersion = 1.0; // string | The HTTP Header meant to specify the version of the API intended to be used
requestParameters.Metadata = new SubmitDocumentMetadata(); // SubmitDocumentMetadata |
requestParameters.Data = new SubmitDocumentData(); // SubmitDocumentData |
requestParameters.XAvalaraClient = John's E-Invoicing-API Client; // string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a \"Fingerprint\" (optional)
try
{
// Submits a document to Avalara E-Invoicing API
DocumentSubmitResponse result = apiInstance.SubmitDocument(requestParameters);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DocumentsApi.SubmitDocument: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Name | Type | Description | Notes |
---|---|---|---|
AvalaraVersion | string | The HTTP Header meant to specify the version of the API intended to be used | |
Metadata | SubmitDocumentMetadata | ||
Data | SubmitDocumentData | ||
XAvalaraClient | string | You can freely use any text you wish for this value. This feature can help you diagnose and solve problems with your software. The header can be treated like a "Fingerprint" | [optional] |
- Content-Type: multipart/form-data
- Accept: application/json, text/xml
Status code | Description | Response headers |
---|---|---|
201 | Created | - |
400 | Bad request | - |
401 | Unauthorized | - |
403 | Forbidden | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]