FlexyAPI documentation

API documentation

Step 9 – Cancel a delivery note

Cancel a delivery note (9.1–9.3) or a quantity receipt note (10.1–10.2) at AADE without issuing a new one.

A delivery note or a quantity receipt note that was issued by mistake, or whose goods never moved, can be cancelled at AADE without issuing a new document. AADE gives the cancellation a MARK of its own and from then on considers the note cancelled.

This works only with provider: "flexy", and only for:

DocumentAADE method Flexy calls
9.1, 9.2, 9.3 (delivery notes)CancelDeliveryNote
10.1, 10.2 (quantity receipt notes)CancelReceivingNote

Any other document cannot be cancelled this way.

Send the cancellation

The request has no body: Flexy sends AADE the note's MARK and the VAT number of the business that issued it. Send it to the id you received when you issued the note:

curl -X POST https://provider-staging.flexy.gr/api/v1/documents/<id>/cancel/ \
  -H "Authorization: Bearer <token>"

Once AADE cancels the note, the API answers with HTTP 200 and the whole document, as in step 2:

{
  "document": {
    "id": "bf640041-d484-49a0-9145-e3d87f628f06",
    "provider": "flexy",
    "status": "failed",
    "mydata_mark": 400001973416999,
    "cancellation_mark": 400001973417043
    // … the other fields of the document
  }
}
FieldMeaning
cancellation_markThe MARK AADE gave the cancellation. It is null only when AADE answered that the note was already cancelled (e.g. when you send the request again after a lost answer), without giving the MARK again.
mydata_markThe MARK of the cancelled note; it does not change.
statusfailed: the note no longer counts.

If you send the cancellation of a note that is already cancelled, the API answers HTTP 200 with the document as it stands, and AADE receives nothing.

Something is wrong

HTTPcodeCauseWhat to do
400cancellation_not_supportedThe document is not a 9.1–9.3 or 10.1–10.2, or it was not issued with provider: "flexy".Nothing: only these documents are cancelled this way.
400document_not_issuedAADE has not registered the note yet (it has no MARK), e.g. because AADE was not answering when it was issued (step 7).Cancel it once it has a MARK.
400aade_rejectedAADE refused the cancellation; detail carries its code and message.Fix what detail mentions.
403onboarding_not_approvedYour registration has not been approved yet.Email us at [email protected].
404not_foundThere is no document with this id in your account.Check the id.
503aade_retry_laterAADE cannot cancel the note yet: for a few seconds after a note is registered AADE does not find its MARK, or AADE did not answer, or another request is cancelling the same note at that moment. This request did not change the note.Send the same request again after the seconds in the Retry-After header.

For 401 errors see step 1.