> For the complete documentation index, see [llms.txt](https://doc.dastra.eu/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.dastra.eu/de/features/cookies/integration/mobile/native.md).

# Native Anwendungen

Diese Seite beschreibt die API zur Verwaltung der Einwilligung. Sie können sie in nativen mobilen Anwendungen verwenden.

Eine native Anwendung zeigt das Web-Banner nicht an: Sie ruft die Konfiguration des Banners ab, zeigt ihren eigenen Einwilligungsbildschirm an und sendet dann die Entscheidungen des Nutzers an Dastra. Beide Aufrufe verwenden den öffentlichen API-Schlüssel.

{% hint style="info" %}
Je nach Hosting-Region Ihrer Organisation ändert sich die Adresse der API (`api-bleu.dastra.eu` statt `api.dastra.eu`). Verwenden Sie die Adresse Ihrer Organisation.
{% endhint %}

Anfragen ohne `Origin`-Header, wie die einer nativen Anwendung, werden akzeptiert, ohne dass die **Zulässigen URLs (CORS)** geprüft werden.

## Die Konfiguration des Banners abrufen

<mark style="color:blue;">`GET`</mark> `https://api.dastra.eu/v1/cookies/public/cookies-widget-settings/{id}?key={key}`

Dieser Endpunkt gibt die vollständige Konfiguration des Banners zurück.

### Pfadparameter

| Name | Typ    | Beschreibung         |
| ---- | ------ | -------------------- |
| `id` | number | Kennung des Banners. |

### Query-Parameter

| Name      | Typ     | Beschreibung                                                                                                                                      |
| --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key`     | string  | Der öffentliche API-Schlüssel.                                                                                                                    |
| `culture` | string  | Die Sprache der Konfiguration (`en`, `fr` usw.). Fehlt sie, verwendet Dastra den Header `Accept-Language` und dann die erste Sprache des Banners. |
| `debug`   | boolean | Bei `true` wird kein Besuchsereignis erfasst.                                                                                                     |

Beispiel einer `200`-Antwort. Die Banner-Texte und einige Felder sind gekürzt; der Inhalt hängt von Ihrer Konfiguration ab.

```json
{
  "translation": {
    "id": "35dddc1a-3ceb-49a8-a8d2-fc343fdb56a3",
    "lang": "en",
    "startupTitle": "We use cookies",
    "startupDisclaimer": "Cookies let us personalize content and ads, provide social media features and analyze our traffic.",
    "buttonAcceptLabel": "Accept all",
    "buttonSettingsLabel": "Customize",
    "buttonLaterLabel": "Refuse all",
    "buttonConfirmLabel": "Save my choices",
    "innerTitle": "These are our services that use cookies",
    "categoryNecessaryLabel": "Strictly necessary",
    "categoryPreferenceLabel": "Preferences",
    "categoryAnalyticalLabel": "Analytics",
    "categoryMarketingLabel": "Marketing",
    "successMessage": "Your preferences have been saved."
  },
  "groups": [
    {
      "label": "Analytics",
      "excerpt": "Analytics cookies help us understand how visitors use the site.",
      "purpose": "Analytical",
      "services": [
        {
          "id": "e213aca4-79b7-4b93-2bad-08d897969898",
          "name": "Google Analytics",
          "slug": "google-analytics",
          "domain": "analytics.google.com",
          "logoUrl": "https://api.dastra.eu/v1/favicon/analytics.google.com",
          "privacyPolicyUrl": "https://policies.google.com/privacy",
          "defaultConsent": false,
          "requiredConsent": true,
          "purpose": "Analytical",
          "description": null,
          "cookies": [
            {
              "id": "de529978-3ae0-496d-bf25-daac9d7230c7",
              "serviceId": null,
              "name": "_ga",
              "description": null,
              "value": null,
              "thirdParty": false,
              "path": null,
              "domain": null,
              "expiryDays": 400
            }
          ],
          "lang": "en",
          "consentModeV2Permissions": []
        }
      ],
      "description": "Analytics cookies help us understand how visitors use the site.",
      "requiredConsent": true,
      "defaultConsent": false
    }
  ],
  "lang": "en",
  "availableLocales": ["en", "fr"],
  "id": 1,
  "versionKey": "36df80ee-235c-4485-b9e2-f28f5568f572",
  "lastVersionGeneration": "2026-10-12T14:28:55Z",
  "label": "Example banner",
  "enabled": true,
  "disableBanner": false,
  "saveConsentProof": true,
  "developerMode": false,
  "position": "BottomLeft",
  "timerTrigger": 0,
  "scrollTrigger": 0,
  "showFixedButton": true,
  "showCloseButton": true,
  "continueWithoutAcceptButton": false,
  "enableGlobalPrivacyControl": false,
  "hideCopyright": false,
  "buttonLayout": "Circle",
  "buttonLogoUrl": null,
  "autoGeneratedCookieNotice": false,
  "cookieNoticeUrl": "",
  "bgColor": "#FFFFFF",
  "colorTitle": "#0A153B",
  "colorBtn": "#687c77",
  "colorText": "#0A153B",
  "colorPrimary": "#EF4A2A",
  "colorSecondary": "#687c77",
  "customCSS": "",
  "fontFamily": "'Segoe UI', Tahoma, Geneva, Verdana, sans-serif",
  "consentStorageMode": "Cookies",
  "consentCookieName": null,
  "consentCookieDomain": null,
  "consentCookieExpiryTime": 180
}
```

Die Antwort entspricht dem Modell `CookieWidgetPublicDto`. Eine `400`-Antwort bedeutet eine nicht zulässige Origin, ein deaktiviertes Banner oder ein abgelaufenes Abonnement.

## Einwilligungen erfassen

<mark style="color:green;">`POST`</mark> `https://api.dastra.eu/v1/cookies/public/collect/{id}?key={key}`

Diese Methode erfasst Cookie-Einwilligungen.

### Pfadparameter

| Name | Typ    | Beschreibung         |
| ---- | ------ | -------------------- |
| `id` | number | Kennung des Banners. |

### Query-Parameter

| Name  | Typ    | Beschreibung                   |
| ----- | ------ | ------------------------------ |
| `key` | string | Der öffentliche API-Schlüssel. |

### Request-Body

| Name        | Typ    | Beschreibung                                                                                                                                                         |
| ----------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`      | string | Der Ereignistyp: `Visit`, `Quit` oder `Consents`.                                                                                                                    |
| `consents`  | object | Die Liste der Einwilligungen des Nutzers (siehe das Beispiel unten).                                                                                                 |
| `consentId` | string | Die aktuelle Einwilligungskennung, falls bereits eine Einwilligung erfasst wurde.                                                                                    |
| `referrer`  | string | Die Adresse der Seite oder des Bildschirms, von dem das Ereignis stammt.                                                                                             |
| `userId`    | string | Pseudonyme Kennung des Nutzers in Ihren Systemen (optional). Siehe [Nutzeridentifizierung](https://doc.dastra.eu/de/features/cookies/integration/identification.md). |

Beispiel eines Bodys:

```json
{
  "type": "Consents",
  "referrer": "my-app://settings/privacy",
  "userId": "{your_pseudonymous_user_id}",
  "consents": {
    "consentId": "6f47576e-5a0c-4219-8efe-331e72bab73a",
    "lang": "en-US",
    "versionKey": "36df80ee-235c-4485-b9e2-f28f5568f572",
    "cookieConsents": [
      {
        "id": "e213aca4-79b7-4b93-2bad-08d897969898",
        "name": "Google Analytics",
        "slug": "google-analytics",
        "consent": true,
        "date": "2026-10-12T14:00:04.133Z",
        "purpose": "Analytical"
      }
    ]
  }
}
```

Die `200`-Antwort enthält die Kennung der erfassten Einwilligung, zum Beispiel `140f213b-de17-4572-99a7-5075ccbcbbec`. Bewahren Sie sie in der Anwendung für die nächsten Aufrufe auf: Sie ist die Kennung des Einwilligungsnachweises. Ereignisse von Bots werden ignoriert, und der Nachweis wird nur gespeichert, wenn die Option **Speicherung der Einwilligung** aktiviert ist.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.dastra.eu/de/features/cookies/integration/mobile/native.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
