# Toggling marketing consent

This endpoint is used for toggling the marketing permission for an email. The marketing permission for an email is normally gathered [via the customer tagging](/techdocs/implementing-nosto/implement-on-your-website/manual-implementation/adding-the-customer-information.md).

This endpoint is only intended for use when the consent needs to be programmatically managed and should be a considered an advanced use case.

### Token

This endpoint requires an Email token.

## Usage

### Granting consent

```
curl -v -X POST https://api.nosto.com/api/v1/customers/consent/john.doe@nosto.com/true \
--user :WI0j2oN7TgG42tlblX3yzOQ5xvCYc2oYj9eWg79lghVq8R0nKQXlVE9wvihBUFOw
```

### Revoking consent

```
curl -v -X POST https://api.nosto.com/api/v1/customers/consent/john.doe@nosto.com/false \
--user :WI0j2oN7TgG42tlblX3yzOQ5xvCYc2oYj9eWg79lghVq8R0nKQXlVE9wvihBUFOw
```


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nosto.com/techdocs/apis/rest/customers/toggling-email-opt-in-using-the-consent-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
