Subscribe contact to brands
const url = 'https://api.optizmo.com/deploy/v1/contacts/93942e96f5acd83e2e047ad8fe03114d/subscriptions';const options = { method: 'POST', headers: {Authorization: '<Authorization>', 'Content-Type': 'application/json'}, body: '{"brandIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.optizmo.com/deploy/v1/contacts/93942e96f5acd83e2e047ad8fe03114d/subscriptions \ --header 'Authorization: <Authorization>' \ --header 'Content-Type: application/json' \ --data '{ "brandIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ] }'Subscribes the contact to the given brands and returns the updated subscription list. Only brands the contact is not already subscribed to are added.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The contact identity: the MD5 hex digest of the lowercased email address,
md5(lower(email)). Uppercase hex digests are accepted. For example, the
contact with email Test@Email.com is addressed by
md5('test@email.com') = 93942e96f5acd83e2e047ad8fe03114d.
Request Body required
Section titled “Request Body required ”object
Ids of the brands to subscribe the contact to. Every id must be a brand in your account.
Example generated
{ "brandIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ]}Responses
Section titled “ Responses ”The contact’s updated brand subscriptions.
The brands the contact is subscribed to.
object
object
The brand id accepted by the subscribe and unsubscribe endpoints.
Example
{ "brands": [ { "name": "Acme" } ]}One or more brand ids are not brands in your account, or the request body fails validation.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
Examples
A brand id is not a brand in your account
{ "type": "https://docs.optizmo.com/deploy/error-codes#invalid_request_error", "status": 400, "title": "Invalid request", "detail": "Unknown brand id(s): 497f6eca-6276-4993-bfeb-53cbbbba6f08", "code": "invalid_request_error", "instance": "/deploy/v1/contacts/93942e96f5acd83e2e047ad8fe03114d/subscriptions", "errors": [ { "detail": "Unknown brand id(s): 497f6eca-6276-4993-bfeb-53cbbbba6f08", "pointer": "/brandIds" } ]}The request body fails validation
{ "type": "https://docs.optizmo.com/deploy/error-codes#invalid_request_error", "status": 400, "title": "Invalid request", "detail": "each value in brandIds must be a UUID", "code": "invalid_request_error", "instance": "/deploy/v1/contacts/93942e96f5acd83e2e047ad8fe03114d/subscriptions", "errors": [ { "detail": "each value in brandIds must be a UUID" } ]}Missing or invalid API key.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
Example
{ "type": "https://docs.optizmo.com/deploy/error-codes#authentication_error", "status": 401, "title": "Authentication failed", "detail": "credentials required", "code": "authentication_error", "instance": "/deploy/v1/contacts"}Permission denied.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
Example
{ "type": "https://docs.optizmo.com/deploy/error-codes#permission_error", "status": 403, "title": "Permission denied", "detail": "api key required", "code": "permission_error", "instance": "/deploy/v1/contacts"}No contact with this emailMd5 exists in your account.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
Example
{ "type": "https://docs.optizmo.com/deploy/error-codes#not_found_error", "status": 404, "title": "Not found", "detail": "Contact not found", "code": "not_found_error", "instance": "/deploy/v1/contacts/93942e96f5acd83e2e047ad8fe03114d"}A bulk contact operation or schema change is in progress for this account
(code: operation_in_progress). Retry after the number of seconds given in the
Retry-After header.
Error envelope returned by every v1 endpoint for failures, following RFC 9457
Problem Details with code and errors extensions.
object
URI identifying the problem type; dereferences to its documentation.
HTTP status code applicable to this problem.
Short, human-readable summary of the problem type.
Detailed explanation specific to this occurrence.
Error code identifying the specific error condition.
URI reference identifying this specific occurrence (the request URI).
Provides additional information when the error relates to specific request fields.
object
Detailed explanation for this specific field error.
JSON Pointer (RFC 6901) to the request body value that caused the error (e.g. /email, /attributes/firstName).
The URI query parameter that caused the error (e.g. pageSize, name[invalid]).
Example
{ "type": "https://docs.optizmo.com/deploy/error-codes#operation_in_progress", "status": 409, "title": "Conflict", "detail": "A bulk contact operation or schema change is in progress for this account, retry later", "code": "operation_in_progress", "instance": "/deploy/v1/contacts/93942e96f5acd83e2e047ad8fe03114d"}Headers
Section titled “Headers ”Seconds to wait before retrying.