# Test safely (https://eulabel.eu/docs/documentation/get-started/test-safely)

> 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.



There is no sandbox and there are no test keys. Every key reaches production, and anything you publish is public, so test in a separate project, keep new passports in draft, and delete the project when you finish.

**Video: Test without publishing** (https://pub-7ea90ccdf0f545b3ad4613d72e450782.r2.dev/test-safely.mp4). An explainer: use a separate project, and send publish: false to keep a passport in draft.

```mermaid
flowchart TD
    A[Separate project]:::blue --> B["publish: false"]:::orange
    B --> C[Check the draft]:::orange
    C --> D[Archive project]:::gray
    D --> E[Delete project]:::rose
```

## Use a separate project
Create a project named so that nobody mistakes it for real work, such as `Test wine`. Every product in it is deleted with the project, so cleanup is one action. See [Projects and products](https://eulabel.eu/docs/documentation/dashboard/projects-and-products).

## Keep a passport in draft
Add `"publish": false` on a GTIN that has never been published. EUlabel saves the passport and checks it, but keeps it in draft even when it is compliant.

This uses a `wine.json` from the [quickstart](https://eulabel.eu/docs/documentation/get-started/quickstart). If you already published that one, run its [save step](https://eulabel.eu/docs/documentation/get-started/quickstart#save-a-passport-to-a-file) again for a fresh GTIN.

> **Error**
> `publish: false` doesn't take anything down. On a GTIN with a live passport, it saves a new draft and the live version stays public. To take it offline, withdraw it.

#### cURL


```bash
jq '. + {publish: false}' wine.json | curl -X POST https://api.eulabel.eu/v1/passports \
  -H "Authorization: Bearer $EULABEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d @-
```

#### JavaScript


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

const body = JSON.parse(readFileSync('wine.json', 'utf8'));
const res = await fetch('https://api.eulabel.eu/v1/passports', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EULABEL_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ ...body, publish: false }),
});
const passport = await res.json();
if (!res.ok) throw new Error(`${passport.error.code}: ${passport.error.message}`);

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

#### Python


```python
import json, os, requests

body = json.load(open("wine.json"))
res = requests.post(
    "https://api.eulabel.eu/v1/passports",
    headers={"Authorization": f"Bearer {os.environ['EULABEL_API_KEY']}"},
    json={**body, "publish": False},
)
passport = res.json()
if not res.ok:
    raise SystemExit(f"{passport['error']['code']}: {passport['error']['message']}")

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

Response, `201 Created`. The passport is compliant but stays a draft:

```json
{
  "id": "ps_15cfypx",
  "productId": "95032d85-1baf-4c8d-9a2e-06625314e384",
  "gtin": "05609777334735",
  "digitalLink": "https://eulabel.eu/01/05609777334735",
  "qrCodeUrl": "https://eulabel.eu/01/05609777334735",
  "status": "draft",
  "version": 1,
  "schemaVersion": "v0.1.0",
  "createdAt": "2026-11-01T00:44:12.187Z",
  "updatedAt": "2026-11-01T00:44:12.187Z",
  "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"
  }
}
```

To publish it later, send the same request without `publish`, or send only `{ "productId": "..." }`.

> **Warning**
> A draft on a fresh GTIN is not invisible. Its Digital Link still redirects, to a holding page that shows the product name, brand, GTIN and category. The passport data stays private, and the passport JSON returns 404.

## Delete what you made
You can't delete a single product. Withdraw one passport, or delete the whole project.

| Action | What it removes | QR code | Undo |
| --- | --- | --- | --- |
| Withdraw | The public passport. Your data stays | Opens a holding page | Publish again |
| Archive project | Nothing public. Published labels stay live | Works as before | **Restore** on **Projects** |
| Delete project | Every product in the project, with its passports and scan history | Returns `404`, and the GTIN is free again | None |

Withdraw takes a passport offline within seconds. `GET /products/{id}/passport` then returns `404`, or the open draft if there is one. Your data is kept: send `{ "productId": "..." }` to publish again. `$EULABEL_PRODUCT_ID` comes from the quickstart.

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

```json
{ "id": "ps_rlqgjz", "status": "archived", "version": 2, "schemaVersion": "v0.2.0", "withdrawnAt": "2026-11-01T12:13:53.101Z" }
```

A second withdraw returns `409 not_published`.

To delete the project, archive it first. Both calls need an organization key with `projects:write`. A project key gets `403 scope_violation`. Look up the ID by project name:

```bash
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')
```


> **Error**
> Check `$EULABEL_PROJECT_ID` is your test project. Deleting can't be undone.


```bash
curl -X POST https://api.eulabel.eu/v1/projects/$EULABEL_PROJECT_ID/archive \
  -H "Authorization: Bearer $EULABEL_API_KEY"

curl -X DELETE https://api.eulabel.eu/v1/projects/$EULABEL_PROJECT_ID \
  -H "Authorization: Bearer $EULABEL_API_KEY"
```

| Call | Success | Error |
| --- | --- | --- |
| Archive | `200` with `archivedAt` | `409 conflict` if already archived |
| Delete | `204` with no body | `409 conflict` if not archived yet |

The dashboard has no archive button, so archiving is API only. Once a project is archived, an owner or admin can also delete it: on **Projects**, under **Archived projects**, click **Delete permanently** and confirm with **Delete project**.

