Skip to content

Record or remove marketing consent

PUT
/customers/{id}/marketing
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.

id
required

UUID v7

string format: uuid

Example

019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f

UUID v7

Media typeapplication/json
object
channel
required
string
Allowed values: email sms phone post
state
required
string
Allowed values: granted withdrawn
method

How the customer told you. Required to record agreement; ignored when withdrawing.

string
Allowed values: phone in_person in_writing email other
note
string
<= 500 characters

Consent and its history, after the change

Media typeapplication/json
object
channels
required
Array<object>
object
channel
required
string
Allowed values: email sms phone post
state
required
string
Allowed values: granted withdrawn never_asked other_address unconfirmed
changedAt
required
string | null format: date-time
source
required
string | null
Allowed values: shop_signup shop_checkout shop_account office import api
by
required
string | null
email
required
string | null
history
required
Array<object>
object
id
required

UUID v7

string format: uuid
channel
required
string
Allowed values: email sms phone post
state
required
string
Allowed values: granted withdrawn unconfirmed
source
required
string
Allowed values: shop_signup shop_checkout shop_account office import api
method
required
string | null
Allowed values: phone in_person in_writing email other
by
required
string
byKind
required
string
Allowed values: staff customer system
wording
required
string | null
note
required
string | null
email
required
string | null
at
required
string format: date-time

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

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

Not a member, missing the scope, or a support session

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

No such customer

Media typeapplication/json
object
error
required
string
message
required
string

Example

{
"error": "not_found",
"message": "Customer not found"
}

Validation failed

Media typeapplication/json
object
error
required
string
Allowed values: validation
message
required
string
issues
required
Array<object>
object
path
required
string
message
required
string

Example

{
"error": "validation",
"issues": [
{
"path": "email",
"message": "Invalid email"
}
]
}