Record or remove marketing consent
const url = 'https://example.com/customers/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f/marketing';const options = { method: 'PUT', headers: { cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"channel":"email","state":"granted","method":"phone","note":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://example.com/customers/019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f/marketing \ --header 'Content-Type: application/json' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token> \ --data '{ "channel": "email", "state": "granted", "method": "phone", "note": "example" }'Sets one channel to granted or withdrawn, for the customer’s current email address: if that address later changes, the yes stops counting (other_address) until it is recorded again. Granting email needs an email on the customer (409 otherwise). Recording agreement needs method: how the customer told you (phone, in_person, in_writing, email, other). Withdrawing needs nothing and is always allowed, even while the business’s bill is unpaid. Stamped with the person signed in (source office) or the key or app (source api), and written to the history. Setting a channel to the state it already has changes nothing. An erased customer can only be withdrawn.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”UUID v7
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8fUUID v7
Request Bodyrequired
Section titled “Request Bodyrequired”object
How the customer told you. Required to record agreement; ignored when withdrawing.
Responses
Section titled “Responses”Consent and its history, after the change
object
object
object
UUID v7
Example
{ "channels": [ { "channel": "email", "state": "granted", "source": "shop_signup" } ], "history": [ { "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "channel": "email", "state": "granted", "source": "shop_signup", "method": "phone", "byKind": "staff" } ]}Not signed in
object
Example
{ "error": "not_found", "message": "Customer not found"}Not a member, missing the scope, or a support session
object
Example
{ "error": "not_found", "message": "Customer not found"}No such customer
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}