Email Address Management
Reading
Endpoint |
|
Request Type |
GET |
Rate Limiting |
300 requests per second |
Description: The GET v2/email
endpoint retrieves the current email address for a game assigned player id.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
user_id |
The Game Assigned Player ID of the player you are retrieving the email address for. This must match the value provided by the game client’s Teak SDK integration. |
Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status' and 'email' keys. 'status' will be 'ok' and 'email' will either be the player’s email address or null if the player has no email address in Teak. |
Example |
|
Error Responses
Not Found
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Reading Subscription Status
Endpoint |
|
Request Type |
GET |
Rate Limiting |
300 requests per second |
Description: The GET v2/email/subscription_status
endpoint retrieves the current subscription status and delivery fault flag for a given email address.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
An email address. |
Success Response
Status Code |
200 |
||||||||||||
Response Body |
JSON dictionary with 'status', 'channel', 'state', 'delivery_fault', 'email', and 'categories' keys.
|
||||||||||||
Example |
|
Error Responses
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Retrieving Recent Unsubscriptions
Endpoint |
|
Request Type |
GET |
Rate Limiting |
50 requests per second |
Description: The GET v2/email/unsubscriptions
endpoint retrieves a list of email addresses that have opted out since the given timestamp.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
since |
An ISO 8601 timestamp. Only email addresses that have opted out since this time will be returned. Example: |
Optional Parameters
limit |
The number of recent unsubs to return. Will be clamped to [1, 10000]. Defaults to 1,000 |
after |
A pagination token from a previous call to v2/email/unsubscriptions |
Success Response
Status Code |
200 |
||||||
Response Body |
JSON dictionary with 'status', and 'opt_outs' keys.
|
||||||
Example |
|
Error Responses
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Updating
Endpoint |
|
Request Type |
POST |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The v2/email
endpoint allows for server side modification of player email addresses. For example, this API can be connected to your internal administrative tools to ensure that the email address Teak has on file for a player is promptly updated in response to any modifications made in your internal administrative tools.
Please be aware that Teak enforces that each player may only have a single email address, and each email address may only belong to a single player. The response to this API will inform you of the actions Teak took in order to preserve these invariants while making the requested change.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
user_id |
The Game Assigned Player ID of the player you are updating the email address for. This must match the value provided by the game client’s Teak SDK integration. |
The email address to assign to this player. |
Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status' and 'action' keys. 'status' will be 'ok'. 'action' will be one of 'moved_and_changed', 'moved', 'changed', 'added', or 'none', depending on the action taken to update the email address for the player. |
Example |
|
Email Changed Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status', 'action', and 'previous_email' keys. 'action' will be 'changed', and 'previous_email' will be the email address previously on file for the user before this API call. |
Example |
|
Email Moved Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status', 'action', and 'previous_player_ids' keys. 'action' will be 'moved', and 'previous_player_ids' will be an array of strings of all the game assigned player ids Teak has associated with the internal player record that previously had the given email address. |
Example |
|
Email Moved And Changed Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status', 'action', 'previous_email', and 'previous_player_ids' keys. 'action' will be 'moved_and_changed', 'previous_email' will be the email address previously on file for the user before this API call, and 'previous_player_ids' will be an array of strings of all the game assigned player ids Teak has associated with the internal player record that previously had the given email address. |
Example |
|
Error Responses
Player under an Exclusion
Status Code |
422 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Not Found
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Updating Subscription Status
Endpoint |
|
Request Type |
POST |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The POST v2/email/subscription_status
endpoint updates the current subscription status for a given email address.
It is not necessary for Teak to have previously seen the given email address for the game. Changes made to email addresses not previously seen will apply to the address as soon as it is associated with a player.
Updating subscription status will not clear any delivery faults. See Clear Delivery Fault to clear a delivery fault.
Requests to update a spam_report
state to opt_out
will be ignored.
Required Parameters
game_id |
Your Teak App ID |
||||||
secret_key |
Your Teak Server Secret |
||||||
An email address. |
|||||||
state |
One of 'opt_out', 'available', or 'opt_in'
|
Success Response
Status Code |
200 |
||||||||||||||
Response Body |
JSON dictionary with 'status', 'channel', 'state', 'previous_state', 'delivery_fault', 'email', and 'categories' keys.
|
||||||||||||||
Example |
|
Error Responses
Unknown State
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages.. |
Example |
|
Invalid email address
Status Code |
422 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Updating Category Subscription Status
Endpoint |
|
Request Type |
POST |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The POST v2/email/subscription_status/:category_identifier
endpoint updates the current subscription status for a given email address and Opt Out Category.
It is not necessary for Teak to have previously seen the given email address for the game. Changes made to email addresses not previously seen will apply to the address as soon as it is associated with a player.
Required Parameters
category_identifier |
Note that this is a path parameter. The identifier of the opt out category the email’s subscription status is being updated for. |
||||
game_id |
Your Teak App ID |
||||
secret_key |
Your Teak Server Secret |
||||
An email address. |
|||||
state |
One of 'opt_out' or 'opt_in'
|
Success Response
Status Code |
200 |
||||||||||||||
Response Body |
JSON dictionary with 'status', 'channel', 'state', 'previous_state', 'delivery_fault', 'email', and 'category' keys.
|
||||||||||||||
Example |
|
Error Responses
Unknown State
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages.. |
Example |
|
Invalid email address
Status Code |
422 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Clear Delivery Fault
Endpoint |
|
Request Type |
DELETE |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The DELETE v2/email/delivery_fault
endpoint clears the delivery fault flag for a given email address.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
The email address the subscription state was updated for. |
Success Response
Status Code |
200 |
||||
Response Body |
JSON dictionary with 'status' and 'email' keys.
|
||||
Example |
|
Error Responses
Invalid email address
Status Code |
422 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Removing
Endpoint |
|
Request Type |
DELETE |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The DELETE v2/email
endpoint allows for removal of an email address from a player record in Teak. Teak will retain the subscription status for removed email addresses, and if the email is later readded the previous subscriptoin status will apply.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
user_id |
The Game Assigned Player ID of the player you are updating the email address for. This must match the value provided by the game client’s Teak SDK integration. |
Email Removed Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status' and 'action' keys. 'status' will be 'ok' and 'action' will be 'removed'. |
Example |
|
Email Already Absent Success Response
Status Code |
200 |
Response Body |
JSON dictionary with 'status' and 'action' keys. 'status' will be 'ok' and 'action' will be 'none'. |
Example |
|
Error Responses
Not Found
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|