Delete invoice by ID

DELETE/invoices/{invoiceId}

Logically deletes an invoice (sets invoice status to deleted).

Audit event:

  • invoice.delete

Privilege:

  • finance-invoices.manage

Errors:

  • INVOICE_NOTFOUND - Invoice not found
  • INVOICE_ALREADY_DELETED - Invoice already deleted
  • COLLECTION_MEMBER_CHANGE_IS_NOT_ALLOWED - Invoice is collection member. Changing collection member data is not allowed
  • NETTING_STATEMENT_NOT_CANCELED_OR_DRAFT - Netting statemant not in 'canceled' or 'draft' mode. Can not delete invoice
  • INVOICE_DELETE_NOT_ALLOWED - Only 'draft' invoice can be deleted
  • NOT_AUTHORIZED - Not authorized - missing required privileges
  • NOT_PLATFORM_OWNER - Not authorized - not platform owner
  • NOT_AUTHENTICATED - Not authenticated
  • INT_APP_ERROR - Unexpected internal error
Base URL
https://api-cpaas.sms.es/finance/sit/v1
Authentication

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

Request

Path parameters

invoiceIdintegerrequired

Invoice ID

Request example

cURL · cURL
curl -L -X DELETE "https://api-cpaas.sms.es/finance/sit/v1/invoices/{invoiceId}" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <access_token>"

Responses

Invoice deleted successfully

application/json
accountManagerIdinteger | null

Account manager ID (populated when showAccountManager=yes filter is used)

accountManagerNamestring | null

Account manager name (populated when showAccountManager=yes filter is used)

amountNoVatnumber (float)

Invoice amount without VAT (net amount). Can be negative when selfBilling is 'yes'

amountVatnumber (float)

Invoice VAT amount. Can be negative when selfBilling is 'yes'

billingBalanceoneOf

Billing balance information (for PREPAID, POSTPAID, POSTPAID-CONTROL invoices) (for PREPAID, POSTPAID, POSTPAID-CONTROL invoices)

Show child attributes
oneOf of:
BillingBalance · object

Billing balance information

idinteger

Balance ID

namestring

Balance name

resourceUrlstring

Resource URL to access the balance

Option 2 · null
billingTypeNamestring | null

Billing type name. Required and returned for control invoice only

classAreastring

Document class area (sales or purchase)

Possible values: sales, purchase
classCodeNamestring

Document class code name. Supported values include CUSTOMER_INVOICE, SUPPLIER_INVOICE, NETTING_INVOICE, CONTROL_INVOICE, CREDIT_DEBIT_NOTE, SUPPLIER_CR_DB_NOTE

classDomainstring

Document class domain (typically "invoice" or "netting")

collectionLeadIdinteger

If document is a member of collection, this value contains ID of collection lead document (0 if not applicable)

collectionLeadNettingInvoiceIdinteger

Netting statement ID of collection lead (0 if not applicable)

collectionLeadNettingInvoiceNumberstring

Netting statement number of collection lead (empty if not applicable)

collectionLeadNettingInvoicePaymentStatusstring

Netting statement payment status of collection lead (empty if not applicable)

collectionLeadNettingInvoiceStatusstring

Netting statement status of collection lead (empty if not applicable)

collectionLeadNettingInvoiceTotalnumber (float)

Netting statement total amount of collection lead

collectionLeadNettingInvoiceTotalPaidnumber (float)

Netting statement total paid amount of collection lead

collectionLeadNettingInvoiceTotalUnpaidnumber (float)

Netting statement total unpaid amount of collection lead

collectionLeadNumberstring

If document is a member of collection, this value contains number of collection lead document (empty if not applicable)

collectionModestring

Document collection mode (none if not part of collection)

Possible values: none, member, lead
commentstring | null

Description or comment in case invoice is credit or debit note. Not available when invoice list is returned

currencyinteger

Currency ID (ISO 4217 numeric)

currencyCodestring

ISO 4217 currency code

custAddressstring

Customer primary address

custAddress2string

Customer secondary address line

custAttnstring

Customer attention/contact person

custCitystring

Customer city

custCountryinteger

Customer country code/ID

custIDinteger

Customer/Business Partner ID

custNamestring

Full customer name

custPOBoxstring

Customer P.O. Box

custPoststring

Customer postal code

custShortNamestring

Customer short name or abbreviation

custVatNumberstring

Customer VAT/Tax number

customerTypestring

Type of customer (e.g., business, individual, Enterprise)

dataSourceCodeNamestring

Data source code name. Supported values include PREPAID, POSTPAID, FINANCE, SUPPLIER-INVOICE, POSTPAID-SUPPLIER-INVOICE, POSTPAID-CONTROL

dataSourceIdinteger

Data source identifier

deliveryDatestring (date)

Document delivery date

disputeNextIdinteger

ID of next related dispute document if applicable

disputeStatusstring

Dispute status if applicable (e.g., "none" when no dispute)

disputeStatusDatestring | null (date-time)

Timestamp of dispute status change

docsDeliveryDlrStatusstring

DLR (delivery receipt) status (e.g., "none", "success", "failed")

docsDeliveryDlrStatusDatestring | null (date-time)

Timestamp of DLR status change

docsDeliveryStatusstring

Status of document delivery (e.g., "none", "pending", "delivered")

docsDeliveryStatusDatestring | null (date-time)

Timestamp of last delivery status change

documentSyncobject | null

Arbitrary JSON object holding document synchronization data. Returned if syncStatus is done, error, misc, exported or invalid

domainCodeNamestring

Domain code name. Supported values include BULK

domainIdinteger

Domain identifier

domainNamestring

Domain display name

domainProductinteger

Product ID associated with domain

domesticCurrencyinteger

Domestic currency ID for multi-currency support (0 if not used)

domesticCurrencyAmountNoVATnumber (float)

Amount in domestic currency without VAT (0 if not used)

domesticCurrencyAmountVATnumber (float)

Amount in domestic currency including VAT (0 if not used)

domesticCurrencyCodestring

Domestic currency ISO code (empty if not used)

domesticCurrencyRatenumber (float)

Exchange rate used to calculate domestic currency amounts (0 if not used)

domesticCurrencyRoundingnumber (float)

Rounding difference in domestic currency (0 if not used)

domesticCurrencyTotalnumber (float)

Total in domestic currency (0 if not used)

dtsSelectorCodeNamestring

DTS selector code name (empty if not applicable)

dtsSelectorIdinteger

DTS selector ID (0 if not applicable)

extentarray | null

Extended invoice data (present on invoice get; may be omitted in invoice list)

Show child attributes
datastring

Extent value stored as JSON string

fieldTypeinteger

Field type ID

fieldTypeCodeNamestring

Field type code name

insertDatestring | null (date-time)

Insert timestamp

invoiceIdinteger

Invoice ID

updateDatestring | null (date-time)

Update timestamp

externalRefIdstring

External reference ID for integration

filesarray | null

Associated invoice files/documents (present on invoice get; may be omitted in invoice list)

Show child attributes
dataSourceFileTypeCodeNamestring

Data source file type code (e.g. INVOICE_PDF, ATTACHMENT)

dataSourceFileTypeidinteger

Data source file type ID (note: API returns this key with lowercase 'i' in 'id')

fileSystemFileFilenamestring

File system / storage file name

fileSystemFileStatusstring

File system storage status

Possible values: stored, cached, volatile
fileSystemFileStatusDtstring | null (date-time)

File system status timestamp

filenamestring

Original file name

idinteger

File record ID

insertDtstring | null (date-time)

When the file was registered

invoiceIdinteger

Invoice ID this file is attached to

sizeinteger

File size in bytes

min: 0
statusstring

File availability status

Possible values: available, archived, deleted, misc
statusDtstring | null (date-time)

Status timestamp

statusInfostring

Optional status message or error info

idinteger

Unique invoice identifier

industryNamestring

Customer industry classification

insertDtstring (date-time)

Invoice creation timestamp

instanceIDinteger

System instance ID

invDatestring (date)

Invoice issuance date

invDueDatestring (date)

Payment due date

invNumberstring

Full invoice number

invNumberFixstring

Invoice number prefix/format string

invNumberNuminteger

Invoice number sequence

invPeriodstring

Invoice billing period display string (e.g., "12.12.2025 - 12.12.2025")

invPeriodEndstring | null (date)

Invoice period end date

invPeriodStartstring | null (date)

Invoice period start date

invTypeinteger

Invoice type identifier

invTypeNamestring

Invoice type name

invUidstring

Unique invoice UID (universal identifier)

invoicingDatestring (date)

Date used for invoicing period

invoicingDatePolicystring

Invoicing date calculation policy

Possible values: delivery, creation, approval
itemsarray | null

Invoice line items (present on invoice get; may be omitted in invoice list)

Show child attributes
dataSourceForeignKeyinteger

Foreign key to data source record

dataSourceIdinteger

Data source ID

dtsSelectorCodeNamestring

DTS selector code name

dtsSelectorIdinteger

DTS selector ID

dtsSelectorNamestring

DTS selector display name

idinteger

Item ID

insertDtstring (date-time)

Insert timestamp (UTC)

invoiceIdinteger

Invoice ID this item belongs to

itemTypestring

Item type code (e.g., ITEM-1, ITEM-2)

measureUnitinteger

Measurement unit ID

namestring

Item name/description (may be JSON string for structured data)

ordNuminteger

Order number of the item on the invoice

pricenumber (float)

Item unit price

quantitynumber (float)

Item quantity

quantityModeinteger

Quantity calculation mode (0=comment, 1=use quantity, 2=use quantity_more, 3=use both)

quantityMorenumber (float)

Additional quantity parameter

statusstring

Item status (e.g., active, deleted)

statusDtstring (date-time)

Status timestamp (UTC)

totalNoVatnumber (float)

Total net amount for item

totalVatnumber (float)

Total VAT for item

vatInPriceinteger

VAT included in price (0=no, 1=yes)

Possible values: 0, 1
langstring

Invoice language code

nettingInvoiceIdinteger

Related netting invoice ID (0 if not applicable)

nettingInvoiceNumberstring

Related netting invoice number (empty if not applicable)

nettingInvoiceStatusstring

Status of related netting invoice (empty if not member of netting)

nettingPaymentStatusstring

Payment status of netting invoice (empty if not member of netting)

nettingTotalnumber (float)

Total amount for netting. Can be negative when selfBilling is 'yes'

nettingTotalPaidnumber (float)

Paid netting amount

nettingTotalUnpaidnumber (float)

Unpaid netting amount

overDueDateinteger

Days overdue (negative if not yet overdue)

ownerBpBriefNamestring

Owner business partner brief name

ownerBpNamestring

Owner business partner full name

ownerIdinteger

Owner business partner ID

ownerNamestring

Owner/Company name

ownerVatNumberstring

Owner/Company VAT number

paymentStatusstring

Payment status of the invoice

Possible values: none, open, on-hold, closed
paymentStatusDatestring | null (date-time)

Timestamp of payment status change

processingStatusstring

Processing status if document has recalculation or other processing tasks

Possible values: none, scheduled, running, done, canceled
reminderStatusstring

Reminder status for payment

Possible values: enabled, disabled, open, closed, misc
roundingnumber (float)

Difference between invoice total and amount including VAT value

selfBillingstring

Indicator that invoice is credit note or not. If value is 'yes' and document is netting statement, it indicates that document is in favor of buyer but issued by seller.

Possible values: yes, no
sitInvoiceEmailImportIdinteger

Email import ID if invoice was imported

smsCountinteger | null (int64)

Amount of messages. Required and returned for postpaid and control invoices only

statusstring

Invoice status

Possible values: draft, approved, rejected, deleted, misc, canceled, archived, imported
statusDtstring | null (date-time)

Timestamp of last status change

syncModestring

Synchronization mode

Possible values: disabled, primary, secondary
syncStatusstring

Synchronization status

Possible values: none, waiting, syncing, done, error, misc, exported, invalid
syncStatusDtstring | null (date-time)

Timestamp of sync status change

templateIDinteger

Template used for invoice generation

totalnumber (float)

Invoice gross amount. Can be negative when selfBilling is 'yes'

totalPaidnumber (float)

Invoice paid amount

totalUnpaidnumber (float)

Invoice unpaid amount

vatnumber (float)

Total VAT amount (same as amountVat)

vatInPriceinteger

Whether VAT is included in unit price (0=no, 1=yes)

Possible values: 0, 1
vatInTotalinteger

Whether VAT is included in total (0=no, 1=yes)

Possible values: 0, 1
vatPercentnumber (float)

VAT percentage rate

Example response
{
  "amountNoVat": 5,
  "amountVat": 5,
  "billingBalance": {
    "id": 8,
    "name": "HRS_Dell Prepaid EUR",
    "resourceUrl": "https://api-stg-cpaas.sms.es/bulk/billing/v2/total-balances/8"
  },
  "classArea": "sales",
  "classCodeName": "CUSTOMER_INVOICE",
  "classDomain": "invoice",
  "collectionLeadId": 0,
  "collectionLeadNettingInvoiceId": 0,
  "collectionLeadNettingInvoiceNumber": "",
  "collectionLeadNettingInvoicePaymentStatus": "",
  "collectionLeadNettingInvoiceStatus": "",
  "collectionLeadNettingInvoiceTotal": 0,
  "collectionLeadNettingInvoiceTotalPaid": 0,
  "collectionLeadNettingInvoiceTotalUnpaid": 0,
  "collectionLeadNumber": "",
  "collectionMode": "none",
  "currency": 978,
  "currencyCode": "EUR",
  "custAddress": "CALLE RIBERA DEL LOIRA 8 28042",
  "custAddress2": "",
  "custAttn": "",
  "custCity": "Madrid",
  "custCountry": 756,
  "custID": 3000005,
  "custName": "HRS_Dell",
  "custPOBox": "",
  "custPost": "",
  "custShortName": "HRS_Dell",
  "custVatNumber": "",
  "customerType": "",
  "dataSourceCodeName": "PREPAID",
  "dataSourceId": 1,
  "deliveryDate": "2026-02-06",
  "disputeNextId": 0,
  "disputeStatus": "none",
  "disputeStatusDate": null,
  "docsDeliveryDlrStatus": "none",
  "docsDeliveryDlrStatusDate": null,
  "docsDeliveryStatus": "none",
  "docsDeliveryStatusDate": null,
  "domainCodeName": "BULK",
  "domainId": 1,
  "domainName": "Bulk SMS",
  "domesticCurrency": 0,
  "domesticCurrencyAmountNoVAT": 0,
  "domesticCurrencyAmountVAT": 0,
  "domesticCurrencyCode": "",
  "domesticCurrencyRate": 0,
  "domesticCurrencyRounding": 0,
  "domesticCurrencyTotal": 0,
  "dtsSelectorCodeName": "",
  "dtsSelectorId": 0,
  "externalRefId": "",
  "id": 6113,
  "industryName": "",
  "insertDt": "2026-02-06T10:09:53Z",
  "instanceID": 3000003,
  "invDate": "2026-02-06",
  "invDueDate": "2026-02-06",
  "invNumber": "060226-3",
  "invNumberFix": "060226-%d",
  "invNumberNum": 3,
  "invPeriod": "",
  "invPeriodEnd": null,
  "invPeriodStart": null,
  "invType": 1,
  "invTypeName": "Bulk Invoice - Prepaid Topup",
  "invUid": "bd15ca50-40c4-7c41-805e-de469bb9139e",
  "invoicingDate": "2026-02-06",
  "invoicingDatePolicy": "delivery",
  "lang": "en",
  "nettingInvoiceId": 0,
  "nettingInvoiceNumber": "",
  "nettingInvoiceStatus": "",
  "nettingPaymentStatus": "",
  "nettingTotal": 0,
  "nettingTotalPaid": 0,
  "nettingTotalUnpaid": 0,
  "overDueDate": 25,
  "ownerBpBriefName": "",
  "ownerBpName": "",
  "ownerId": 0,
  "ownerName": "On-Premise Staging",
  "ownerVatNumber": "",
  "paymentStatus": "open",
  "paymentStatusDate": "2026-02-06T10:09:53Z",
  "processingStatus": "none",
  "reminderStatus": "closed",
  "rounding": 0,
  "selfBilling": "no",
  "sitInvoiceEmailImportId": 0,
  "status": "approved",
  "statusDt": "2026-02-06T10:09:53Z",
  "syncMode": "secondary",
  "syncStatus": "none",
  "syncStatusDt": null,
  "templateID": 1,
  "total": 5,
  "totalPaid": 0,
  "totalUnpaid": 5,
  "vat": 0,
  "vatInPrice": 0,
  "vatInTotal": 0,
  "vatPercent": 0
}