> For the complete documentation index, see [llms.txt](https://docs.ruuvi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ruuvi.com/communicate-with-ruuvi-cloud/cloud/user-api/marketing-consent.md).

# Marketing Consent

Marketing email consent management

## Get marketing consent

> Returns the authenticated user's effective newsletter subscription state\
> from Sendy. Sendy is the source of truth.\
> \
> \`consent\` is \`true\` only when \`status\` is \`subscribed\`. Pending confirmation,\
> delivery failures, complaints, and missing subscribers all return\
> \`consent: false\` with the corresponding status.<br>

```json
{"openapi":"3.0.3","info":{"title":"Ruuvi Cloud - User API","version":"1.0.0"},"tags":[{"name":"Marketing-Consent","description":"Marketing email consent management"}],"servers":[{"url":"https://network.ruuvi.com"},{"url":"https://testnet.ruuvi.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Success":{"type":"object","required":["result","data"],"properties":{"result":{"type":"string","enum":["success"]},"data":{"description":"Endpoint-specific payload"}}},"Error":{"type":"object","required":["result","error","code"],"properties":{"result":{"type":"string","enum":["error"]},"error":{"type":"string","description":"Human-readable explanation"},"code":{"type":"string","description":"Machine-readable primary error code"},"sub_code":{"nullable":true,"type":"string","description":"Optional secondary code useful for client logic"}}}}},"paths":{"/marketing-consent":{"get":{"summary":"Get marketing consent","description":"Returns the authenticated user's effective newsletter subscription state\nfrom Sendy. Sendy is the source of truth.\n\n`consent` is `true` only when `status` is `subscribed`. Pending confirmation,\ndelivery failures, complaints, and missing subscribers all return\n`consent: false` with the corresponding status.\n","operationId":"getMarketingConsent","tags":["Marketing-Consent"],"responses":{"200":{"description":"Current Sendy consent status","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Success"},{"type":"object","properties":{"data":{"type":"object","required":["consent","status"],"properties":{"consent":{"type":"boolean"},"status":{"type":"string","description":"Effective subscriber state reported by Sendy.","enum":["subscribed","unsubscribed","unconfirmed","bounced","soft_bounced","complained","not_found"]}}}}}]}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Sendy integration failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```

## Update marketing consent

> Subscribes or unsubscribes the authenticated user's email address in Sendy,\
> then returns the effective status held by Sendy.\
> \
> When subscribing to a double opt-in list, the normal result may be\
> \`unconfirmed\`. Set \`silent\` to \`true\` only when the client is allowed to\
> bypass the confirmation email and complete the subscription immediately.<br>

```json
{"openapi":"3.0.3","info":{"title":"Ruuvi Cloud - User API","version":"1.0.0"},"tags":[{"name":"Marketing-Consent","description":"Marketing email consent management"}],"servers":[{"url":"https://network.ruuvi.com"},{"url":"https://testnet.ruuvi.com"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}},"schemas":{"Success":{"type":"object","required":["result","data"],"properties":{"result":{"type":"string","enum":["success"]},"data":{"description":"Endpoint-specific payload"}}},"Error":{"type":"object","required":["result","error","code"],"properties":{"result":{"type":"string","enum":["error"]},"error":{"type":"string","description":"Human-readable explanation"},"code":{"type":"string","description":"Machine-readable primary error code"},"sub_code":{"nullable":true,"type":"string","description":"Optional secondary code useful for client logic"}}}}},"paths":{"/marketing-consent":{"post":{"summary":"Update marketing consent","description":"Subscribes or unsubscribes the authenticated user's email address in Sendy,\nthen returns the effective status held by Sendy.\n\nWhen subscribing to a double opt-in list, the normal result may be\n`unconfirmed`. Set `silent` to `true` only when the client is allowed to\nbypass the confirmation email and complete the subscription immediately.\n","operationId":"setMarketingConsent","tags":["Marketing-Consent"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["consent","joiningSource","language"],"additionalProperties":false,"properties":{"consent":{"type":"boolean","description":"Set to true to subscribe or false to unsubscribe."},"silent":{"type":"boolean","default":false,"description":"When true, bypass Sendy double opt-in confirmation for subscriptions. Ignored when consent is false."},"joiningSource":{"type":"string","minLength":1,"maxLength":32,"pattern":"^[a-z][a-z0-9_-]*$","description":"Lowercase client identifier stored in Sendy's `joiningSource` custom field. Ignored when consent is false."},"language":{"type":"string","minLength":2,"maxLength":2,"pattern":"^[A-Za-z]{2}$","description":"Two-letter Ruuvi application language code, matching the\nuppercase WPML language-code format used by the Ruuvi website\n(for example, EN, FI, or DE). Input is case-insensitive;\nRuuvi Cloud converts it to uppercase before storing it in\nSendy's Language custom field. Ignored when consent is false.\n"}}}}}},"responses":{"200":{"description":"Consent updated in Sendy","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Success"},{"type":"object","properties":{"data":{"type":"object","required":["consent","status"],"properties":{"consent":{"type":"boolean"},"status":{"type":"string","description":"Effective subscriber state reported by Sendy.","enum":["subscribed","unsubscribed","unconfirmed","bounced","soft_bounced","complained","not_found"]}}}}}]}}}},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Sendy integration failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```
