### BearerAuth Example Source: https://developers.heymarket.com/api-reference/contacts/get-v2 Example of how to use the BearerAuth scheme with a Heymarket team API key. ```http Authorization: Bearer sk_326d6e2fc87a4e42910ca170ad20aa44 ``` -------------------------------- ### User Fetch JSON Example Source: https://developers.heymarket.com/api-reference/users Example of a JSON request body for fetching user information. ```json { "phone": [ "15105553344", "15105553345" ], "email": [ "help@heymarket.com", "example@heymarket.com" ] } ``` -------------------------------- ### Example of Request body for User get Source: https://developers.heymarket.com/api-reference/users Basic /users/get request body. ```json { "phone": ["15105553344", "15105553345"], "email": ["help@heymarket.com", "example@heymarket.com"] } ``` -------------------------------- ### JWT Authentication Request Example Source: https://developers.heymarket.com/authentication Example of sending an API request with a signed JWT. ```bash curl https://api.heymarket.com/v1/inboxes \ -H "Authorization: Bearer YOUR_SIGNED_JWT" ``` -------------------------------- ### Example Request Body for Contact Create Source: https://developers.heymarket.com/api-reference/contacts/create This is an example of a basic request body for creating a contact. ```json { "phone": "15105553344", "last": "Contact", "first": "API", "display_name": "API Contact", "email": "help@heymarket.com", "custom": {}, "is_opted_out": true } ``` -------------------------------- ### Generate JWT Token Source: https://developers.heymarket.com/api-reference/users Example of how to generate a JWT token using a secret and payload. ```text **Step 3:** Generate JWT Token: Use the combined secret value to sign the payload and generate the JWT token. **Step 4:** Use the JWT Token: Once generated, the JWT token can be used in the authorization header of API requests to authenticate and authorize access. To authenticate, provide the API token as a bearer token in an Authorization header like in example below. `Authorization: Bearer eyJhbGcJ9.eyJzdWIY3ODSI6Q.SfleJ_adQssw5c` ``` -------------------------------- ### Example of Request body for Tag creation Source: https://developers.heymarket.com/api-reference/tags-create This is an example of the JSON request body for creating a tag. ```json { "tag": "tag1" } ``` -------------------------------- ### JWT Token Generation Header Example Source: https://developers.heymarket.com/api-reference/messages/send-email Example of the header for generating a JWT token. ```json { "alg": "HS256", ``` -------------------------------- ### Get Template Source: https://developers.heymarket.com/api-reference/templates/get Retrieves a template by its ID. ```shell curl -X GET \"https://api.heymarket.com/v1/template/{id}\" \"Authorization: Bearer YOUR_API_TOKEN\" ``` -------------------------------- ### Contact Status Request Source: https://developers.heymarket.com/api-reference/contacts/status Example of a request body to get the status of a contact. ```json { "id": 10000 } ``` ```json { "phone": "12345678900" } ``` -------------------------------- ### Example Request Body for List Creation Source: https://developers.heymarket.com/api-reference/lists/create This example demonstrates how to structure the request body for creating a list, including title, type, local_id, and contacts. ```json { "title": "My VIP Contacts", "type": "contacts", "local_id": "dc3deb9b-940a-444d-9d0e-8e3087a160e9", "contacts": [1001, 1002, 1003] } ``` -------------------------------- ### Combined Secret Example Source: https://developers.heymarket.com/api-reference/inboxes Example of combining API Secret ID and API Secret Key. ```json "your_api_secret_id" || "your_api_secret_key" ``` -------------------------------- ### Example Request Body for Template Creation Source: https://developers.heymarket.com/api-reference/templates/create This example demonstrates how to create a template with merge tokens for first and last names. ```json { "title": "My first template over the API", "local_id": "88ae517b-ff42-4ef2-958d-86b27db6b21c", "content": { "text": "Hey {{first_name}} {{last_name}}, I created this template with the Heymarket API.\nYour name was populated from merge tokens." }, "archived": false } ``` -------------------------------- ### Example Request Body for Schedule Creation Source: https://developers.heymarket.com/api-reference/schedule This example demonstrates how to create a scheduled message to a specific phone number at a designated time and date. ```json { "local_id": "f4bb74f2-7827-4a61-83c1-04164338fb6f", "content": { "text": "api scheduled message", "to": "14155553434" }, "phone_number": "14155553434", "inbox_id": 413, "execute_at": "2019-07-24T11:30:00-07:00" } ``` -------------------------------- ### JWT Token Generation Example Source: https://developers.heymarket.com/api-reference/contacts/update-v2 Example of constructing the JWT token payload and combining secrets for authentication. ```json { "alg": "HS256", "typ": "JWT" } ``` ```json { "iss": "your_api_secret_id", "iat": current_unix_timestamp } ``` ```json "74f80a77-9b3f-44ac-b3ad-ab68cfb548fa||cPQku7lnSLbnK88UFOBg1a6Q3t1w1RgK" ``` -------------------------------- ### Team User Response Example Source: https://developers.heymarket.com/api-reference/users Example of a JSON response body for a successful team user fetch. ```json { "memberships": [ { "id": 1, "phone": "12345678900", "name": "John Doe", "email": "john.doe@email.com", "role_id": 1, "created_at": "2018-01-01T00:00:00Z", "updated_at": "2018-01-01T00:00:00Z", "user_created_at": "2018-01-01T00:00:00Z", "user_updated_at": "2018-01-01T00:00:00Z", "team_id": 1 } ] } ``` -------------------------------- ### Bearer Token Authentication Example Source: https://developers.heymarket.com/authentication Example of how to authenticate an API request using a Bearer token. ```bash curl https://api.heymarket.com/v1/inboxes \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Contact Status Response Source: https://developers.heymarket.com/api-reference/contacts/status Example of a response body for the contact status. ```json { "id": 10000, "phone": "12345678900" } ``` -------------------------------- ### Get Survey Source: https://developers.heymarket.com/api-reference/surveys-get Get the Survey object for a given ID. ```http GET /v1/survey/{id} ``` -------------------------------- ### Create the list Source: https://developers.heymarket.com/guides/broadcast-messages Create a list with POST /v2/lists. Provide a title, a unique local_id, and at least one recipient source. ```bash curl -X POST https://api.heymarket.com/v2/lists \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "April Reminders", "local_id": "april-reminders-2026", "contacts": [98765, 98766], "phones": ["15105553344", "15105553355"] }' ``` -------------------------------- ### Get Contact Source: https://developers.heymarket.com/api-reference/contacts/get Retrieves a Contact by its ID. ```http GET /v1/contact/{id} ``` -------------------------------- ### Example for sending email to new conversation Source: https://developers.heymarket.com/api-reference/messages/send-email This example shows how to send an email to initiate a new conversation. ```json { ``` -------------------------------- ### Example of Request body for `List` update Source: https://developers.heymarket.com/api-reference/lists/update This is an example of a request body for updating a list, showing how to modify the title and add/remove contacts. ```json { "title": "My Updated List", "add_contacts": [1004, 1005], "remove_contacts": [1001] } ``` -------------------------------- ### Get Team Source: https://developers.heymarket.com/api-reference/team Retrieves the object of the Heymarket team. ```shell curl -X GET \ http://api.heymarket.com/v1/team \ -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' ``` -------------------------------- ### Example Request Body for Template Update Source: https://developers.heymarket.com/api-reference/templates/update This JSON object demonstrates how to update a template, including adding an image to the gallery. ```json { "title": "My first template over api's", "local_id": "88ae517b-ff42-4ef2-958d-86b27db6b21c", "content": { "text": "Hey {{first_name}} {{last_name}}, I created this template with Heymarket API's.\nYour name was populated from merge tokens.\n\n\nMight as well add an image", "gallery": [ { "url": "https://embrace-uploads-mms.s3.us-west-1.amazonaws.com/2ca6e36c-f04e-4ee8-8eb3-7026df4b2225/img.jpg", "original_url": "https://embrace-uploads-mms.s3.us-west-1.amazonaws.com/2ca6e36c-f04e-4ee8-8eb3-7026df4b2225/img.jpg" } ] }, "archived": false } ```