Download invoice file by DTS file type

GET/invoice/{invoiceId}/file-type/{fileType}

Downloads the invoice file by DTS file type (PDF or traffic report XLSX)

Audit event:

  • invoice_by_type.print

Privilege (one of):

  • invoice-docs.view
  • invoice-docs-own.view

Errors:

  • INVOICE_HEADER_NOT_FOUND - Invoice header not found
  • INVOICE_FILE_DOES_NOT_EXIST - Invoice file does not exist
  • TEMPLATE_NOTFOUND - Template not found
  • INVOICE_DOCS_API_TPL_TYPE_NOT_SUPPORTED - Template type is not supported
  • INVOICE_DOCS_API_V2:TRAFFIC_REPORT_MNP_NOT_SUPPORTED - Traffic report mnp traffic not supported
  • INVOICE_DOCS_API_TRAFFIC_REPORT_NOT_SUPPORTED - Traffic report not supported
  • TRAFFIC_REPORT_FILE_DOES_NOT_EXIST - Traffic report file does not exist
  • INVOICE_DOCS_API_DTS_DOMAIN_NOT_SUPPORTED - Given dts domain not supported
  • INVOICE_DOCS_API_TPL_TYPE_CONFIG_NOT_DEFINED - Template config is not defined
  • NOT_AUTHORIZED - Not authorized
  • NOT_AUTHENTICATED - Not authenticated
  • INT_APP_ERROR - Unexpected internal error
Base URL
https://api-cpaas.sms.es/invoice-docs/v2
Authentication

OAuth2 — send Authorization: Bearer <access_token>. Token URL: https://accounts-cpaas.sms.es/oauth2/access-token

Request

Path parameters

invoiceIdintegerrequired

Invoice ID

fileTypestringrequired

DTS file type code name

Possible values: INVOICE, TRAFFIC-REPORT

Query parameters

address_cover_pagestring

Pass value yes in order to get extra cover page with address

Possible values: yes

Request example

cURL · cURL
curl -L -X GET "https://api-cpaas.sms.es/invoice-docs/v2/invoice/{invoiceId}/file-type/{fileType}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access_token>"

Responses

Binary file stream (PDF or XLSX). Headers typically include Content-Disposition (attachment), Content-Type, and Content-Length. Same behaviour as GET by fileId; variation is only via data-filters (e.g. address cover changes PDF bytes for html templates).

application/pdf
Example response
string
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Example response
string