> ## Documentation Index
> Fetch the complete documentation index at: https://api-doc.fidly.be/llms.txt
> Use this file to discover all available pages before exploring further.

# Delivery locations

> Addresses registered on a relation, reusable on its documents.

A delivery location is an address **registered on a relation**, so it does not have
to be re-entered on every document addressed to it. It is an object of the
relation: permissions are those of the `relation` resource, and `relation_id` is
set at creation — an address never moves to another relation.

## Address and identifier

`address` is the same object as a relation's address, with the same rules:
`country_code` required, `street_number` only with `street`
(`422 invalid_address` otherwise). On `PATCH` it is **merged** like on a relation,
and the rules are checked on the result.

`identifier` and `identifier_scheme` designate the location on the Peppol network
(a GLN and the scheme code that says how to read it, `0088` for a GLN). They go
**together**: a half-filled pair is refused (`422 invalid_identifier`), including
when a `PATCH` would remove one half.

## On documents

A document accepts a `delivery_location_id`, at creation as on update, provided the
address belongs to the **same relation** as the document
(`422 invalid_delivery_location`). Changing a document's `relation_id` detaches its
delivery location; `delivery_location_id: null` detaches it too.

## Deleting

Deletion is refused (`409 delivery_location_in_use`) as long as a document is
linked to the location. Deleting the relation deletes its delivery locations
with it.
