All URIs are relative to https://api.sbx.avalara.com/einvoicing
Method | HTTP request | Description |
---|---|---|
download_document | GET /documents/{documentId}/$download | Returns a copy of the document |
fetch_documents | POST /documents/$fetch | Fetch the inbound document from a tax authority |
get_document_list | GET /documents | Returns a summary of documents for a date range |
get_document_status | GET /documents/{documentId}/status | Checks the status of a document |
submit_document | POST /documents | Submits a document to Avalara E-Invoicing API |
File download_document(avalara_version, accept, document_id, opts)
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.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::EInvoicing::V1.configure do |config|
# See Documentation for Authorization section in main README.md for more auth examples.
config.bearer_token='<Your Avalara Identity Access Token>'
config.environment='sandbox'
config.app_name='testApp'
config.app_version='1.2.3'
config.machine_name='testMachine'
end
api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::EInvoicing::V1::DocumentsApi.new api_client
avalara_version = '1.2' # String | The HTTP Header meant to specify the version of the API intended to be used
accept = 'application/pdf' # String | This header indicates the MIME type of the document
document_id = 'document_id_example' # String | The unique ID for this document that was returned in the POST /einvoicing/document response body
opts = {
x_avalara_client: '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.
}
begin
# Returns a copy of the document
result = api_instance.download_document(avalara_version, accept, document_id, opts)
p result
rescue AvalaraSdk::ApiError => e
puts "Error when calling DocumentsApi->download_document: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(File, Integer, Hash)> download_document_with_http_info(avalara_version, accept, document_id, opts)
begin
# Returns a copy of the document
data, status_code, headers = api_instance.download_document_with_http_info(avalara_version, accept, document_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => File
rescue AvalaraSdk::EInvoicing::V1::ApiError => e
puts "Error when calling DocumentsApi->download_document_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
avalara_version | 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 | |
document_id | String | The unique ID for this document that was returned in the POST /einvoicing/document response body | |
x_avalara_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] |
File
- Content-Type: Not defined
- Accept: application/pdf, application/xml, application/json
fetch_documents(avalara_version, document_fetch_request, opts)
Fetch the inbound document from a tax authority
This API allows you to retrieve an inbound document. Pass key-value pairs as parameters in the request, such as the confirmation number, supplier number, and buyer VAT number.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::EInvoicing::V1.configure do |config|
# See Documentation for Authorization section in main README.md for more auth examples.
config.bearer_token='<Your Avalara Identity Access Token>'
config.environment='sandbox'
config.app_name='testApp'
config.app_version='1.2.3'
config.machine_name='testMachine'
end
api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::EInvoicing::V1::DocumentsApi.new api_client
avalara_version = '1.2' # String | The HTTP Header meant to specify the version of the API intended to be used
document_fetch_request = AvalaraSdk::EInvoicing::V1::DocumentFetchRequest.new # DocumentFetchRequest |
opts = {
x_avalara_client: '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.
}
begin
# Fetch the inbound document from a tax authority
result = api_instance.fetch_documents(avalara_version, document_fetch_request, opts)
p result
rescue AvalaraSdk::ApiError => e
puts "Error when calling DocumentsApi->fetch_documents: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> fetch_documents_with_http_info(avalara_version, document_fetch_request, opts)
begin
# Fetch the inbound document from a tax authority
data, status_code, headers = api_instance.fetch_documents_with_http_info(avalara_version, document_fetch_request, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <DocumentFetch>
rescue AvalaraSdk::EInvoicing::V1::ApiError => e
puts "Error when calling DocumentsApi->fetch_documents_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
avalara_version | String | The HTTP Header meant to specify the version of the API intended to be used | |
document_fetch_request | DocumentFetchRequest | ||
x_avalara_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] |
- Content-Type: application/json
- Accept: application/json
get_document_list(avalara_version, opts)
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.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::EInvoicing::V1.configure do |config|
# See Documentation for Authorization section in main README.md for more auth examples.
config.bearer_token='<Your Avalara Identity Access Token>'
config.environment='sandbox'
config.app_name='testApp'
config.app_version='1.2.3'
config.machine_name='testMachine'
end
api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::EInvoicing::V1::DocumentsApi.new api_client
avalara_version = '1.2' # String | The HTTP Header meant to specify the version of the API intended to be used
opts = {
x_avalara_client: '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.
start_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | Start date of documents to return. This defaults to the previous month.
end_date: Time.parse('2013-10-20T19:20:30+01:00'), # Time | End date of documents to return. This defaults to the current date.
flow: 'out', # String | Optionally filter by document direction, where issued = `out` and received = `in`
count: 'true', # String | When set to true, the count of the collection is also returned in the response body
count_only: 'false', # String | When set to true, only the count of the collection is returned
filter: 'id eq 52f60401-44d0-4667-ad47-4afe519abb53', # 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.
top: 10, # Float | 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.
skip: '10' # String | If nonzero, skip this number of results before returning data. Used with <code>$top</code> to provide pagination for large datasets.
}
begin
# Returns a summary of documents for a date range
result = api_instance.get_document_list(avalara_version, opts)
p result
rescue AvalaraSdk::ApiError => e
puts "Error when calling DocumentsApi->get_document_list: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_document_list_with_http_info(avalara_version, opts)
begin
# Returns a summary of documents for a date range
data, status_code, headers = api_instance.get_document_list_with_http_info(avalara_version, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <DocumentListResponse>
rescue AvalaraSdk::EInvoicing::V1::ApiError => e
puts "Error when calling DocumentsApi->get_document_list_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
avalara_version | String | The HTTP Header meant to specify the version of the API intended to be used | |
x_avalara_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] |
start_date | Time | Start date of documents to return. This defaults to the previous month. | [optional] |
end_date | Time | 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] |
count_only | 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 | Float | 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
get_document_status(avalara_version, document_id, opts)
Checks the status of a document
Using the unique ID from POST /einvoicing/documents response body, request the current status of a document.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::EInvoicing::V1.configure do |config|
# See Documentation for Authorization section in main README.md for more auth examples.
config.bearer_token='<Your Avalara Identity Access Token>'
config.environment='sandbox'
config.app_name='testApp'
config.app_version='1.2.3'
config.machine_name='testMachine'
end
api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::EInvoicing::V1::DocumentsApi.new api_client
avalara_version = '1.2' # String | The HTTP Header meant to specify the version of the API intended to be used
document_id = 'document_id_example' # String | The unique ID for this document that was returned in the POST /einvoicing/documents response body
opts = {
x_avalara_client: '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.
}
begin
# Checks the status of a document
result = api_instance.get_document_status(avalara_version, document_id, opts)
p result
rescue AvalaraSdk::ApiError => e
puts "Error when calling DocumentsApi->get_document_status: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_document_status_with_http_info(avalara_version, document_id, opts)
begin
# Checks the status of a document
data, status_code, headers = api_instance.get_document_status_with_http_info(avalara_version, document_id, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <DocumentStatusResponse>
rescue AvalaraSdk::EInvoicing::V1::ApiError => e
puts "Error when calling DocumentsApi->get_document_status_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
avalara_version | String | The HTTP Header meant to specify the version of the API intended to be used | |
document_id | String | The unique ID for this document that was returned in the POST /einvoicing/documents response body | |
x_avalara_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] |
- Content-Type: Not defined
- Accept: application/json
submit_document(avalara_version, metadata, data, opts)
Submits a document to Avalara E-Invoicing API
When a UBL document is sent to this endpoint, it generates a document 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 generated document for reference purposes.
require 'time'
require 'avalara_sdk'
# setup authorization
AvalaraSdk::EInvoicing::V1.configure do |config|
# See Documentation for Authorization section in main README.md for more auth examples.
config.bearer_token='<Your Avalara Identity Access Token>'
config.environment='sandbox'
config.app_name='testApp'
config.app_version='1.2.3'
config.machine_name='testMachine'
end
api_client = AvalaraSdk::ApiClient.new config
api_instance = AvalaraSdk::EInvoicing::V1::DocumentsApi.new api_client
avalara_version = '1.2' # String | The HTTP Header meant to specify the version of the API intended to be used
metadata = AvalaraSdk::EInvoicing::V1::SubmitDocumentMetadata.new({workflow_id: 'partner-einvoicing', data_format: 'ubl-invoice', data_format_version: '2.1', country_code: 'SA', country_mandate: 'SA-Phase1-B2B'}) # SubmitDocumentMetadata |
data = 'data_example' # String | The document to be submitted, as indicated by the metadata fields 'dataFormat' and 'dataFormatVersion'
opts = {
x_avalara_client: '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.
}
begin
# Submits a document to Avalara E-Invoicing API
result = api_instance.submit_document(avalara_version, metadata, data, opts)
p result
rescue AvalaraSdk::ApiError => e
puts "Error when calling DocumentsApi->submit_document: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> submit_document_with_http_info(avalara_version, metadata, data, opts)
begin
# Submits a document to Avalara E-Invoicing API
data, status_code, headers = api_instance.submit_document_with_http_info(avalara_version, metadata, data, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <DocumentSubmitResponse>
rescue AvalaraSdk::EInvoicing::V1::ApiError => e
puts "Error when calling DocumentsApi->submit_document_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
avalara_version | String | The HTTP Header meant to specify the version of the API intended to be used | |
metadata | SubmitDocumentMetadata | ||
data | String | The document to be submitted, as indicated by the metadata fields 'dataFormat' and 'dataFormatVersion' | |
x_avalara_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] |
- Content-Type: multipart/form-data
- Accept: application/json, text/xml