> 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/en/features/cookies/integration/mobile/native.md).

# Native applications

This page describes the consent management API. You can use it in native mobile applications.

A native application does not display the web banner: it retrieves the banner configuration, displays its own consent screen, then sends the user's choices to Dastra. Both calls use the public API key.

{% hint style="info" %}
Depending on the hosting region of your organization, the address of the API changes (`api-bleu.dastra.eu` instead of `api.dastra.eu`). Use the one of your organization.
{% endhint %}

Requests without an `Origin` header, such as those of a native application, are accepted without checking the **Urls authorized (Allowed origins)**.

## Get the banner configuration

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

This endpoint returns the complete configuration of the banner.

#### Path parameters

| Name | Type   | Description               |
| ---- | ------ | ------------------------- |
| `id` | number | Identifier of the banner. |

#### Query parameters

| Name      | Type    | Description                                                                                                                                        |
| --------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `key`     | string  | The public API key.                                                                                                                                |
| `culture` | string  | The language of the configuration (`en`, `fr`, etc.). If missing, Dastra uses the `Accept-Language` header, then the first language of the banner. |
| `debug`   | boolean | When `true`, no visit event is recorded.                                                                                                           |

Example of a `200` response. The banner texts and some fields are abridged; the content depends on your configuration.

```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
}
```

The response matches the `CookieWidgetPublicDto` model. A `400` response means an origin that is not allowed, a disabled banner or an expired subscription.

## Record consents

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

This method collects cookie consents.

#### Path parameters

| Name | Type   | Description               |
| ---- | ------ | ------------------------- |
| `id` | number | Identifier of the banner. |

#### Query parameters

| Name  | Type   | Description         |
| ----- | ------ | ------------------- |
| `key` | string | The public API key. |

#### Request body

| Name        | Type   | Description                                                                                                                                                         |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`      | string | The event type: `Visit`, `Quit` or `Consents`.                                                                                                                      |
| `consents`  | object | The list of the user's consents (see the example below).                                                                                                            |
| `consentId` | string | The current consent identifier, if one has already been collected.                                                                                                  |
| `referrer`  | string | The address of the page or the screen the event comes from.                                                                                                         |
| `userId`    | string | Pseudonymous identifier of the user in your systems (optional). See [User identification](https://doc.dastra.eu/en/features/cookies/integration/identification.md). |

Example of a body:

```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"
      }
    ]
  }
}
```

The `200` response contains the identifier of the collected consent, for example `140f213b-de17-4572-99a7-5075ccbcbbec`. Keep it in the application for the next calls: it is the identifier of the proof of consent. Events sent by bots are ignored, and the proof is stored only if the **Save consent proof** option is enabled.


---

# 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/en/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.
