# Quickstart (https://eulabel.eu/docs/documentation/get-started/quickstart)

> Fetch the complete documentation index at: https://eulabel.eu/docs/llms.txt
> Use this file to discover all available pages before exploring further.
> Full content: https://eulabel.eu/docs/llms-full.txt
> Append .md to any page URL for markdown, or send Accept: text/markdown.



Publish a wine e-label from the dashboard or the API. Both paths end with a QR code that opens a public page.

> **Warning**
> There is no sandbox. Everything you publish here is public, so use a throwaway project and [delete it afterwards](https://eulabel.eu/docs/documentation/get-started/test-safely).

## Path 1: the dashboard
**Video: Publish a wine label in the dashboard** (https://pub-7ea90ccdf0f545b3ad4613d72e450782.r2.dev/quickstart-dashboard.mp4). You create a wine project and a product, complete the wizard, publish, and open the label.

1. On **Projects**, click **New project**. On a new account the button is **Create a project**.
2. Under **What will you label?**, click **Wine**. Enter a **Project name** and click **Create project**.
3. Click **Add product**. Enter the **Product name**, **GTIN (barcode number)** and **Brand**, then click **Create product**.
4. Under **Label**, click **Create label**.
5. Fill in **Wine profile**, **Ingredients and allergens**, **Nutrition**, and **Origin and producers**, clicking **Next** after each step. Your draft saves as you type.
6. On **Review and publish**, click **Publish label**, then **Publish label** again in the dialog.
7. Under **Your label is live**, click **Download QR code** for the print file and **Open label** for the public page.

Anyone who scans the QR code sees the label within seconds.

## Path 2: the API
**Video: Publish a wine label from the terminal** (https://pub-7ea90ccdf0f545b3ad4613d72e450782.r2.dev/quickstart-api.mp4). In a terminal: POST /v1/passports creates a draft, the missing fields are fixed, the passport publishes, a GET reads it back, and the resolver, the service behind the Digital Link, redirects.

You need:

* An organization that has accepted the Terms and Data Processing Agreement. You do this once, during onboarding. Until then every API call returns `403 terms_not_accepted`.
* An [API key](https://eulabel.eu/docs/documentation/get-started/api-keys).
* A wine project named `Test wine`. Create it with steps 1 and 2 above.
* `curl` and [`jq`](https://jqlang.org), for the shell commands.
* For the JavaScript tabs, Node 20 or later. Put the steps together in one `.mjs` file, because they use ES modules.
* For the Python tabs, the `requests` package: `python3 -m venv .venv && source .venv/bin/activate && pip install requests`. Put the steps together in one file.

### Find your project
```bash
export EULABEL_API_KEY="eul_..."

export EULABEL_PROJECT_ID=$(curl -s https://api.eulabel.eu/v1/projects \
  -H "Authorization: Bearer $EULABEL_API_KEY" \
  | jq -r '.projects[] | select(.name == "Test wine") | .projectId')

echo "$EULABEL_PROJECT_ID"
```

    This prints your project's UUID. If it prints nothing, check the project's name and your key.
### Save a passport to a file
    Set `GTIN` to a number you hold. To try the flow without one, these lines make a throwaway number with a valid check digit, the last digit, calculated from the others:

```bash
n=$((RANDOM * RANDOM % 10000000))
b=56097$(printf '%07d' $n)
s=0; for i in 0 1 2 3 4 5 6 7 8 9 10 11; do s=$((s + ${b:$i:1} * (i % 2 ? 3 : 1))); done
export GTIN=$b$(((10 - s % 10) % 10))

cat > wine.json <<EOF
{
  "gtin": "$GTIN",
  "name": "Quinta Demo Tinto 2024",
  "brand": "Quinta Demo",
  "projectId": "$EULABEL_PROJECT_ID",
  "data": {
    "ingredients": ["Grapes", "Preservative: sulphites"],
    "nutrition": {
      "energyKj": 347, "energyKcal": 83,
      "fatG": 0, "saturatedFatG": 0,
      "carbohydratesG": 2.6, "sugarsG": 0.6,
      "proteinG": 0, "saltG": 0
    },
    "allergens": {
      "containsSulphites": true, "containsEgg": false,
      "containsFish": false, "containsMilk": false
    },
    "origin": { "country": "PT" },
    "producers": [{ "name": "Quinta Demo, Lda.", "role": "producer" }]
  }
}
EOF
```

    These are the five mandatory fields for a wine label. On a real product use the GTIN you hold from GS1, the body that issues them.
### Create the passport
#### cURL


```bash
curl -s -X POST https://api.eulabel.eu/v1/passports \
  -H "Authorization: Bearer $EULABEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d @wine.json | tee passport.json

export EULABEL_PRODUCT_ID=$(jq -r .productId passport.json)
```

#### JavaScript


```javascript
import { readFileSync } from 'node:fs';

const api = 'https://api.eulabel.eu/v1';
const headers = { Authorization: `Bearer ${process.env.EULABEL_API_KEY}` };

const res = await fetch(`${api}/passports`, {
  method: 'POST',
  headers: { ...headers, 'Content-Type': 'application/json' },
  body: readFileSync('wine.json'),
});
const passport = await res.json();
if (!res.ok) throw new Error(`${passport.error.code}: ${passport.error.message}`);

console.log(res.status, passport.status, passport.productId);
```

#### Python


```python
import json, os, requests

api = "https://api.eulabel.eu/v1"
headers = {"Authorization": f"Bearer {os.environ['EULABEL_API_KEY']}"}

res = requests.post(f"{api}/passports", headers=headers, json=json.load(open("wine.json")))
passport = res.json()
if not res.ok:
    raise SystemExit(f"{passport['error']['code']}: {passport['error']['message']}")

print(res.status_code, passport["status"], passport["productId"])
```

Response, `201 Created`:

```json
{
  "id": "ps_13ujije",
  "productId": "8f9dbe9a-2b25-4a30-9fa6-abf8507adfb3",
  "gtin": "05609793419652",
  "digitalLink": "https://eulabel.eu/01/05609793419652",
  "qrCodeUrl": "https://eulabel.eu/01/05609793419652",
  "status": "published",
  "version": 1,
  "schemaVersion": "v1.1.0",
  "createdAt": "2026-11-01T00:38:24.312Z",
  "updatedAt": "2026-11-01T00:38:24.312Z",
  "compliance": {
    "status": "compliant",
    "regulation": "EU Wine e-label Regulation (Reg. 2021/2117)",
    "completeness": 100,
    "missingFields": [],
    "documentationUrl": "https://eulabel.eu/docs/knowledge-base/best-practices/compliance-checklist"
  }
}
```

    
> **Warning**
> Use `productId` in every other path. `id` is a short display value and returns 404 in a path. `qrCodeUrl` is the Digital Link, not an image.

    If `echo $EULABEL_PRODUCT_ID` prints `null`, the request failed. Read the `error` in `passport.json`.

    `version` counts saved versions. `schemaVersion` is that count as a label: `v1.1.0` when live, `v0.1.0` in draft.
### Read it back
#### cURL


```bash
curl https://api.eulabel.eu/v1/products/$EULABEL_PRODUCT_ID/passport \
  -H "Authorization: Bearer $EULABEL_API_KEY"
```

#### JavaScript


```javascript
const productId = passport.productId;
const got = await fetch(`${api}/products/${productId}/passport`, { headers });
console.log((await got.json()).status);
```

#### Python


```python
product_id = passport["productId"]
got = requests.get(f"{api}/products/{product_id}/passport", headers=headers)
print(got.json()["status"])
```

Response, `200 OK`, shortened. It returns the latest passport with its `data`, and adds `name`, `category`, `profileVersion` and `audience`. It has no `productId`, because that's in the path:

```json
{
  "id": "ps_1ppi056",
  "gtin": "05609101592008",
  "name": "Quinta Demo Tinto 2024",
  "category": "wine",
  "profileVersion": "wine/2026.10",
  "audience": "owner",
  "digitalLink": "https://eulabel.eu/01/05609101592008",
  "status": "published",
  "version": 1,
  "schemaVersion": "v1.1.0",
  "data": {
    "productType": "wine",
    "ingredients": ["Grapes", "Preservative: sulphites"]
  },
  "compliance": { "status": "compliant", "completeness": 100 }
}
```

### Download the QR code
#### cURL


```bash
curl https://api.eulabel.eu/v1/products/$EULABEL_PRODUCT_ID/qr \
  -H "Authorization: Bearer $EULABEL_API_KEY" \
  -o label-qr.svg
```

#### JavaScript


```javascript
import { writeFileSync } from 'node:fs';

const qr = await fetch(`${api}/products/${productId}/qr`, { headers });
writeFileSync('label-qr.svg', await qr.text());
```

#### Python


```python
qr = requests.get(f"{api}/products/{product_id}/qr", headers=headers)
open("label-qr.svg", "w").write(qr.text)
```

`label-qr.svg` is 512 px wide. Add `?width=` for up to 2048.
### Open the Digital Link
    Paste `digitalLink` into a browser, or scan `label-qr.svg` with a phone. Or check the redirect:

```bash
curl -I https://eulabel.eu/01/$GTIN
```

```text
HTTP/1.1 307 Temporary Redirect
location: https://eulabel.eu/p/8f9dbe9a-2b25-4a30-9fa6-abf8507adfb3
```

## Fix the first error
A 422 means the request itself is wrong, and nothing was saved. Leave out `projectId` and you get this:

```json
{
  "error": {
    "type": "validation_error",
    "message": "Say which sector this product belongs to.",
    "code": "validation_error",
    "param": "category",
    "suggestion": "Send projectId, or category as one of: wine, battery, textile, furniture, construction, toy, detergent, steel, tyre, mattress, aluminium, food, electronics.",
    "documentationUrl": "https://eulabel.eu/docs/api-reference/endpoints/passports"
  }
}
```

Read `param` for the field and `suggestion` for the fix, then send it again.

| Status and code | Cause | Fix |
| --- | --- | --- |
| 422 `validation_error`, `param: category` | Nothing names a sector | Add `projectId` |
| 422 `validation_error`, `param: gtin` | The check digit is wrong, for example `Invalid check digit: expected 6, got 7` | Correct the GTIN |
| 401 `authentication_required` | The key is missing or wrong | Check the `Authorization` header |
| 403 `terms_not_accepted` | The organization hasn't accepted the Terms | An owner or admin opens the dashboard and accepts them |
| 409 `gtin_conflict` | Another organization holds this GTIN | Use a [GTIN you own](https://eulabel.eu/docs/knowledge-base/guides/gtin-ownership) |

## Fix a passport that stays a draft
Missing passport data is not an error. You get `201` with `status: "draft"`, and `compliance.missingFields` lists what to add:

```json
{
  "status": "draft",
  "compliance": {
    "status": "incomplete",
    "completeness": 80,
    "missingFields": [
      {
        "field": "data.allergens",
        "message": "Allergen fields missing or invalid: containsEgg, containsFish, containsMilk.",
        "hint": "Each allergen field must be a boolean (true or false).",
        "documentationUrl": "https://eulabel.eu/docs/knowledge-base/guides/wine-e-label"
      }
    ]
  }
}
```

Send only what is missing. EUlabel merges it into the draft and publishes as soon as the merged passport is compliant:

```bash
curl -X POST https://api.eulabel.eu/v1/passports \
  -H "Authorization: Bearer $EULABEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "gtin": "'$GTIN'",
    "data": {
      "allergens": {
        "containsSulphites": true, "containsEgg": false,
        "containsFish": false, "containsMilk": false
      }
    }
  }'
```


> **Note**
> Check `status` after every call, not just the HTTP code. To keep a new passport private, send `publish: false`. See [Test safely](https://eulabel.eu/docs/documentation/get-started/test-safely).

## Next steps
- [Test safely](https://eulabel.eu/docs/documentation/get-started/test-safely#delete-what-you-made) — Withdraw the passport you just published, then delete the project.
- [API reference](https://eulabel.eu/docs/api-reference/overview/introduction) — Every endpoint, with its parameters and errors.

