> ## Documentation Index
> Fetch the complete documentation index at: https://docs.closient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Brand GLNs

> List, link, unlink and choose the primary of the GS1 Global Location Numbers (GLNs) a brand uses — the programmatic equivalent of the "Global Location Numbers" card on the dashboard's Brand Settings page.

Programmatic equivalent of the "Global Location Numbers" card on the
dashboard's Brand Settings page. The card and the API write through the same
service, so a GLN linked on one reads back on the other.

A GLN (Global Location Number) is a 13-digit GS1 identifier for a place or a
party. Its classification says which: `physical` (a physical location, GS1
Application Identifier 414), `invoicing` (an invoicing party, AI 415) or
`legal` (a legal entity, AI 417). Only GS1 issues GLNs, through the brand's GS1
company prefix: never make one up or derive one from a GTIN.

## When to use

* The brand has GLNs from GS1 that are not on Closient yet.
* The brand's primary GLN has changed.
* A GLN no longer belongs to the brand.

## Auth

`X-API-Key` header or OAuth token. Reading needs any member of the organization
that owns the brand (or any API key of it). Writing needs an OWNER, MANAGER or
EDITOR (or an API key with the EDITOR role or above): a read-only key gets
`403`. A brand of an organization the caller does not belong to is `404`.

## Flow

```
GET    /brands/api/v1/brands/{brand_id}/glns
POST   /brands/api/v1/brands/{brand_id}/glns
GET    /brands/api/v1/brands/{brand_id}/glns/{id}
POST   /brands/api/v1/brands/{brand_id}/glns/{id}/primary
DELETE /brands/api/v1/brands/{brand_id}/glns/{id}
```

`{id}` is the id of the brand-to-GLN link, as the list returns it, not the GLN
itself.

* **`GET .../glns`** — every GLN linked to the brand, primary first: `id`,
  `gln`, `gln_type`, `ai_code`, `label`, `is_primary`, `created`.
* **`POST .../glns`** — link a GLN. Body:

  * `gln` — the 13 digits, check digit included. A wrong check digit is `422`.
  * `gln_type` — `physical`, `invoicing` or `legal`. A GLN already registered
    on Closient under another classification is `409`: one GLN has one
    classification everywhere, so report it rather than retrying with another
    type.
  * `label` — optional, such as `Head office`.
  * `is_primary` — optional; `true` demotes the current primary. The first GLN
    a brand gets is primary whatever this says.

  A GLN the brand already has is `409`. Returns `201` and the new link.
* **`POST .../glns/{id}/primary`** — make that GLN the brand's primary,
  demoting the current one. Idempotent.
* **`DELETE .../glns/{id}`** — unlink the GLN from the brand (`204`). The GLN
  stays in Closient's registry. When the primary is unlinked, the brand's next
  GLN becomes primary.

## Verify

1. `GET .../glns` again and confirm each GLN you linked is there with the
   classification you intended, and exactly one is primary.
2. Confirm no GLN you did not mean to touch was unlinked.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.