### Get a List by ID (JSON Example) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Example JSON response for retrieving a specific list by its ID. This shows the structure of a successful 'OK' response. ```json { "status": 200, "data": { "listId": 0, "listName": null, "folderId": 0, "ipPoolId": 0, "bounceDomainAlias": null, "bounceHandling": null, "bounceUnsubscribeCount": 0, "createDate": "0001-01-01T00:00:00", "enableBrowserLink": false, "enableDoubleOptIn": false, "enableDynamicContent": false, "enableGoogleAnalytics": false, "enableInternationalization": false, "enableListHygiene": false, "enableListRemovalHeader": false, "enableListRemovalLink": false, "enableListrakAnalytics": false, "enableSpamScorePersonalization": false, "enableToNamePersonalization": false, "enableUniversalEmailKeySetting": false, "fromEmail": null, "fromName": null, "googleTrackingDomains": null, "linkDomainAlias": null, "mediaDomainAlias": null } } ``` -------------------------------- ### Get a Campaign (PHP) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 This PHP example shows how to fetch a specific campaign's details using Guzzle. It requires an access token and the list and campaign identifiers. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Campaign/{campaignId}', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get List Import Success Response Source: https://api.listrak.com/email Example of a successful response (200 OK) when retrieving a list import. ```json { "status": 200, "data": { "importFileId": 0, "importFileName": null, "importDate": "0001-01-01T00:00:00" } } ``` -------------------------------- ### Get Contact (C#) Source: https://api.listrak.com/email Example of using HttpClient in C# to send a GET request to retrieve a contact by its identifier. Ensure the Authorization header is correctly set. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/Contact/{contactIdentifier}"); ``` -------------------------------- ### Get Contact (PHP) Source: https://api.listrak.com/email Example of using GuzzleHttp in PHP to send a GET request to retrieve a contact. The base URI and Authorization header should be configured. ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Contact/{contactIdentifier}', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get List Import Not Found Response Source: https://api.listrak.com/email Example of a NotFound response (404) when the specified list or import file cannot be found. ```json { "status": 404, "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", "message": "Unable to locate a resource associated with the listId and importFileId supplied." } ``` -------------------------------- ### Created Resource Response Example (JSON) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Example JSON response indicating successful creation of a resource. Includes the status code and the ID of the newly created resource. ```json { "status": 201, "resourceId": "{ResourceId}" } ``` -------------------------------- ### Not Found Error Example (JSON) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Example JSON response when a requested resource cannot be found. Includes status code, error code, and a message specifying the inability to locate the resource. ```json { "status": 404, "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", "message": "Unable to locate a resource associated with the listId supplied." } ``` -------------------------------- ### Get Message Links C# Example Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Use this code to retrieve a list of message links for a given list and message. Ensure you have set up an HttpClient with the correct base address and authorization token. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/Message/{messageId}/Link"); ``` -------------------------------- ### Get Response Samples Source: https://api.listrak.com/email JSON response structures for GET requests. ```JSON { * "status": 200, * "data": { * "enableUniversalEmailKeySetting": false, * "savedMessageId": 0, * "savedMessageName": null, * "campaignId": 0, * "bodyHtml": null, * "bodyText": null, * "codePage": 0, * "createDate": "0001-01-01T00:00:00", * "lastModifiedDate": "0001-01-01T00:00:00", * "enablePassalong": false, * "enableTracking": false, * "externalCampaignId": null, * "fromEmail": null, * "fromName": null, * "googleAnalyticsCampaignName": null, * "googleAnalyticsCampaignContent": null, * "replyEmail": null, * "subject": null, * "toName": null } } ``` ```JSON { * "status": 400, * "error": "ERROR_INVALID_PARAMETER", * "message": "An invalid value was supplied for {Parameter}." } ``` ```JSON { * "status": 401, * "error": "ERROR_UNAUTHORIZED", * "message": "Authorization was denied for this request." } ``` ```JSON { * "status": 404, * "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", * "message": "Unable to locate a resource associated with the listId and savedMessageId supplied." } ``` -------------------------------- ### Get Message Summary (C#) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Example C# code to retrieve a summary of a message, including metrics like opens, clicks, and conversions. Requires authentication and valid listId and messageId. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/Message/{messageId}/Summary"); ``` -------------------------------- ### Get an Event Response Samples Source: https://api.listrak.com/email JSON response structures for GET event requests. ```json { * "status": 200, * "data": { * "eventId": 0, * "eventName": null, * "eventGroupId": 0, * "status": null } } ``` ```json { * "status": 400, * "error": "ERROR_INVALID_PARAMETER", * "message": "An invalid value was supplied for {Parameter}." } ``` ```json { * "status": 401, * "error": "ERROR_UNAUTHORIZED", * "message": "Authorization was denied for this request." } ``` ```json { * "status": 404, * "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", * "message": "Unable to locate a resource associated with the listId and eventId supplied." } ``` -------------------------------- ### Get All Campaigns (C#) Source: https://api.listrak.com/email Use HttpClient to make a GET request to retrieve all campaigns associated with a specific list. The Authorization header must be set to 'Bearer (Your token value)'. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/Campaign"); ``` -------------------------------- ### OAuth2 Token Request Example Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Use this example to request an OAuth2 token. Ensure the Content-Type is set to x-www-form-urlencoded and include your client ID and secret in the request body. ```http POST /OAuth2/Token Content-Type: application/x-www-form-urlencoded grant_type: client_credentials client_id: (Your client ID) client_secret: (Your client secret) ``` -------------------------------- ### GET /v1/Folder Source: https://api.listrak.com/email Retrieves all folders in the account. ```APIDOC ## GET /v1/Folder ### Description Returns your account's collection of folders. ### Method GET ### Endpoint /v1/Folder ### Response #### Success Response (200) - **status** (integer) - HTTP status code. - **data** (array) - Collection of return data from the given call. #### Response Example { "status": 200, "data": [ { "folderId": 0, "folderName": null } ] } ``` -------------------------------- ### Create a List Implementation Source: https://api.listrak.com/email Examples of how to perform a POST request to create a list using C# and PHP. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List", new { ListName = null, FolderId = 0, IpPoolId = 0, BounceDomainAlias = null, BounceHandling = null, BounceUnsubscribeCount = 0, CreateDate = 0001-01-01T00=00=00 , EnableBrowserLink = false, EnableDoubleOptIn = false, EnableDynamicContent = false, EnableGoogleAnalytics = false, EnableInternationalization = false, EnableListHygiene = false, EnableListRemovalHeader = false, EnableListRemovalLink = false, EnableListrakAnalytics = false, EnableSpamScorePersonalization = false, EnableToNamePersonalization = false, EnableUniversalEmailKeySetting = false, FromEmail = null, FromName = null, GoogleTrackingDomains = null, LinkDomainAlias = null, MediaDomainAlias = null }); ``` ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Create a Folder Request Source: https://api.listrak.com/email Examples for creating a new folder using JSON, C#, or PHP. ```json { "folderName": "string" } ``` ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/Folder", new { FolderName = null }); ``` ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/Folder', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Retrieve List Import Summary Source: https://api.listrak.com/email Examples for fetching import summary data using C# and PHP. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/ListImport/{importFileId}/Summary"); ``` ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/ListImport/{importFileId}/Summary', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get Message Status - PHP Source: https://api.listrak.com/email This PHP Guzzle client example demonstrates how to get the send status for a message. Ensure the access token is correctly passed in the request headers. ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Message/{messageId}/Clicker', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create List Import Request Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for initiating a list import using C# and PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/ListImport", new { FileDelimiter = null, FileMappings = null, FileName = null, FileStream = null, HasColumnNames = false, ImportType = null, SegmentationImportType = null, SuppressEmailNotifications = false, TextQualifier = null, TriggerJourney = false, IncludeUnsubscribed = false }); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List/{listId}/ListImport', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Retrieve EventGroup GET Request in C# Source: https://api.listrak.com/email Example of sending a GET request to retrieve a specific event group using HttpClient. Requires setting the Authorization header and BaseAddress. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/EventGroup/{eventGroupId}"); ``` -------------------------------- ### Retrieve List Import Details Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for fetching list import data using C# and PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/ListImport/{importFileId}"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/ListImport/{importFileId}', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Retrieve EventGroup GET Request in PHP Source: https://api.listrak.com/email Example of sending a GET request to retrieve a specific event group using Guzzle HTTP client. Requires setting the Authorization header. ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/EventGroup/{eventGroupId}', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create List Import in PHP Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 This PHP example demonstrates how to send a POST request to create a list import. It utilizes Guzzle HTTP client and requires an access token and the JSON body for the request. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List/{listId}/ListImport', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Get EventGroups Request Source: https://api.listrak.com/email Implementation examples for retrieving event groups using C# and PHP. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/EventGroup"); ``` ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/EventGroup', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get Segmentation Field Group Example (JSON) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Example JSON response when successfully retrieving a profile field group. Includes status and the group's data, such as ID, name, and position. ```json { "status": 200, "data": { "segmentationFieldGroupId": 0, "segmentationFieldGroupName": null, "position": 0 } } ``` -------------------------------- ### Get Segmentation Field (JSON Example) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Example JSON response for a successful retrieval of a segmentation field. This shows the structure of the data returned, including field ID, name, data type, and position. ```json { "status": 200, "data": { "segmentationFieldId": 0, "segmentationFieldName": null, "segmentationFieldGroupId": 0, "dataType": null, "maxLength": 0, "position": 0 } } ``` -------------------------------- ### SavedMessage GET Response Examples Source: https://api.listrak.com/email JSON response structures for successful and error scenarios when retrieving saved messages. ```JSON { "status": 200, "data": [ { "savedMessageId": 0, "savedMessageName": null, "campaignId": 0, "createDate": "0001-01-01T00:00:00", "lastModifiedDate": "0001-01-01T00:00:00", "externalCampaignId": null, "subject": null } ] } ``` ```JSON { "status": 400, "error": "ERROR_INVALID_PARAMETER", "message": "An invalid value was supplied for {Parameter}." } ``` ```JSON { "status": 401, "error": "ERROR_UNAUTHORIZED", "message": "Authorization was denied for this request." } ``` ```JSON { "status": 404, "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", "message": "Unable to locate a resource associated with the listId supplied." } ``` -------------------------------- ### Retrieve List Imports Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for fetching list import data using C# and PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/ListImport"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/ListImport', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create Campaign using C# HttpClient Source: https://api.listrak.com/email Use this C# code to send a POST request to create a campaign. Requires setting the Authorization header and BaseAddress. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/Campaign", new { CampaignName = null }); ``` -------------------------------- ### Retrieve Split Test Details Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Use these examples to fetch specific split test information using C# or PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/SplitTest/{splitTestId}"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/SplitTest/{splitTestId}', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Retrieve Transactional Message Activity Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Examples for making a GET request to the transactional message activity endpoint using C# and PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/TransactionalMessage/{transactionalMessageId}/Activity"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/TransactionalMessage/{transactionalMessageId}/Activity', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get a Folder by ID in C# Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Retrieve a specific folder using its ID with this C# code example. An authorization token is required. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/Folder/{folderId}"); ``` -------------------------------- ### POST /v1/List - Create a List Source: https://api.listrak.com/email Creates a new list within your account. ```APIDOC ## POST /v1/List ### Description Creates a new list in your account. ### Method POST ### Endpoint /v1/List ### Parameters ### Request Body * **listName** (string) - Required - The name of the list. * **folderId** (integer) - Optional - The ID of the folder to place the list in. * **ipPoolId** (integer) - Optional - The ID of the IP pool to associate with the list. * **bounceHandling** (string) - Optional - Specifies how bounce emails should be handled. * **enableDoubleOptIn** (boolean) - Optional - Enables double opt-in for new subscribers. * **fromEmail** (string) - Optional - The default 'From' email address for this list. * **fromName** (string) - Optional - The default 'From' name for this list. ### Response #### Success Response (200) - **status** (integer) - HTTP status code. - **data** (List) - The newly created list object. #### Error Response (400) - **status** (integer) - HTTP status code. - **error** (string) - Error code. - **message** (string) - Error message. #### Error Response (401) - **status** (integer) - HTTP status code. - **error** (string) - Error code. - **message** (string) - Error message. ### Request Example ```json { "listName": "My New List", "folderId": 123, "ipPoolId": 456, "bounceHandling": "unsubscribe", "enableDoubleOptIn": true, "fromEmail": "sender@example.com", "fromName": "Sender Name" } ``` ``` -------------------------------- ### Get Transactional Messages - PHP Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 This PHP example shows how to fetch all transactional messages for a given list ID using Guzzle. Ensure your access token is valid. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/TransactionalMessage', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create a Campaign (C#) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Use this snippet to create a new campaign for a specified list. Ensure you have a valid authorization token and the correct list ID. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/Campaign", new { CampaignName = null }); ``` -------------------------------- ### Get List Import Summary (PHP) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Use this to retrieve a summary of a specific list import. Requires an access token. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/ListImport/{importFileId}/Summary', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Retrieve Message Link Clickers via C# and PHP Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for performing a GET request to the message link clicker endpoint using HttpClient in C# and Guzzle in PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/Message/{messageId}/Link/{messageLinkId}/Clicker"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Message/{messageId}/Link/{messageLinkId}/Clicker', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Retrieve Saved Content Folders Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for fetching a collection of saved content folders using C# and PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/SavedContentFolder"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/SavedContentFolder', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### POST /v1/Folder Source: https://api.listrak.com/email Creates a new folder in the system. ```APIDOC ## POST /v1/Folder ### Description Creates a new folder. ### Method POST ### Endpoint /v1/Folder ### Request Body - **folderName** (string) - Required - Name of the folder. ### Request Example { "folderName": "string" } ### Response #### Success Response (201) - **status** (integer) - HTTP status code. - **resourceId** (string) - An identifier used to locate the created resource. #### Response Example { "status": 201, "resourceId": "{ResourceId}" } ``` -------------------------------- ### Get Message Link Clickers - PHP Source: https://api.listrak.com/email This PHP Guzzle client example shows how to fetch contacts that clicked a message link. The access token must be provided in the headers. ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Message/{messageId}/Link/{messageLinkId}/Clicker', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create an Event Implementation Source: https://api.listrak.com/email Client implementations for creating a new event via POST. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/Event", new { EventName = null, EventGroupId = 0, Status = null }); ``` ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List/{listId}/Event', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Get List Import Summary (C#) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Use this to retrieve a summary of a specific list import. Requires an authorization token. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/ListImport/{importFileId}/Summary"); ``` -------------------------------- ### Get Message Links PHP Example Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 This PHP code snippet demonstrates how to fetch message links using Guzzle HTTP client. It requires setting the base URI and including an Authorization header with your Bearer token. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Message/{messageId}/Link', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create a Folder Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Use this to create a new folder resource. Requires an OAuth 2 bearer token for authorization. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/Folder", new { FolderName = null }); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/Folder', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Get Conversation Message Links (PHP) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 This PHP example demonstrates how to fetch conversation message links using Guzzle HTTP client. It requires setting the base URI and including an authorization header with your access token. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Conversation/{conversationId}/Message/{conversationMessageId}/Link', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create Saved Message - C# Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 This C# example shows how to create a new saved message. It includes setting the base URI, authorization, and sending the message payload as JSON. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/SavedMessage", new { SavedMessageName = null, Subject = null, Preheader = null, FromName = null, FromEmail = null, ReplyEmail = null, BodyHtml = null, BodyText = null, CampaignId = 0, ExternalCampaignId = null }); ``` -------------------------------- ### Create Folder - C# Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Creates a new folder in your account. The request body should contain the folder details. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/Folder", folderResource); ``` -------------------------------- ### Get Contacts by List ID (Example) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Retrieves contacts associated with a specific list. Supports filtering by subscription state, external ID, segmentation fields, and date ranges. Pagination is handled via cursor and count parameters. ```OpenAPI GET /v1/List/{listId}/Contact ``` -------------------------------- ### GET /v1/List - Get all Lists Source: https://api.listrak.com/email Retrieves a collection of all lists within your account. ```APIDOC ## GET /v1/List ### Description Returns your account's collection of lists. ### Method GET ### Endpoint /v1/List ### Parameters ### Request Body None ### Response #### Success Response (200) - **status** (integer) - HTTP status code. - **data** (List) - Collection of return data from the given call. #### Error Response (400) - **status** (integer) - HTTP status code. - **error** (string) - Error code. - **message** (string) - Error message. #### Error Response (401) - **status** (integer) - HTTP status code. - **error** (string) - Error code. - **message** (string) - Error message. ### Request Example ```json { "status": 200, "data": [ { "listId": 0, "listName": null, "folderId": 0, "ipPoolId": 0, "bounceDomainAlias": null, "bounceHandling": null, "bounceUnsubscribeCount": 0, "createDate": "0001-01-01T00:00:00", "enableBrowserLink": false, "enableDoubleOptIn": false, "enableDynamicContent": false, "enableGoogleAnalytics": false, "enableInternationalization": false, "enableListHygiene": false, "enableListRemovalHeader": false, "enableListRemovalLink": false, "enableListrakAnalytics": false, "enableSpamScorePersonalization": false, "enableToNamePersonalization": false, "enableUniversalEmailKeySetting": false, "fromEmail": null, "fromName": null, "googleTrackingDomains": null, "linkDomainAlias": null, "mediaDomainAlias": null } ] } ``` ``` -------------------------------- ### Create Campaign using PHP GuzzleHttp Source: https://api.listrak.com/email This PHP snippet demonstrates creating a campaign using the GuzzleHttp client. Ensure the 'Authorization' header and JSON body are correctly set. ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List/{listId}/Campaign', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### GET /v1/IpPool - Get all IpPools Source: https://api.listrak.com/email Retrieves a collection of all IP pools associated with your account. ```APIDOC ## GET /v1/IpPool ### Description Returns your account's collection of IP pools. ### Method GET ### Endpoint /v1/IpPool ### Parameters ### Request Body None ### Response #### Success Response (200) - **status** (integer) - HTTP status code. - **data** (IpPool) - Collection of return data from the given call. #### Error Response (400) - **status** (integer) - HTTP status code. - **error** (string) - Error code. - **message** (string) - Error message. #### Error Response (401) - **status** (integer) - HTTP status code. - **error** (string) - Error code. - **message** (string) - Error message. ### Request Example ```json { "status": 200, "nextPageCursor": null, "data": [ { "ipPoolId": 0, "ipPoolDescription": null } ] } ``` ``` -------------------------------- ### Retrieve Split Tests via API Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for fetching split tests using C# and PHP clients. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/SplitTest"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/SplitTest', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get an Event Implementation Source: https://api.listrak.com/email Client implementations for retrieving a specific event via GET. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/Event/{eventId}"); ``` ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Event/{eventId}', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Start List Import to Update Contact Fields (C#) Source: https://api.listrak.com/email Initiates a list import to update specified contact profile fields using HttpClient. Ensure the Authorization header is correctly set. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/Contact/SegmentationField", new []); ``` -------------------------------- ### Update Event Group Response Examples Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Examples of successful and error responses when updating an event group. ```json { "status": 200, "resourceId": "{ResourceId}" } ``` ```json { "status": 400, "error": "ERROR_INVALID_PARAMETER", "message": "An invalid value was supplied for {Parameter}." } ``` ```json { "status": 404, "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", "message": "Unable to locate a resource associated with the listId and eventGroupId supplied." } ``` ```json { "status": 401, "error": "ERROR_UNAUTHORIZED", "message": "Authorization was denied for this request." } ``` -------------------------------- ### Retrieve List Imports - PHP Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 This PHP example demonstrates how to fetch import records for a given list using Guzzle HTTP client. It requires setting up the client with the base URI and including the authorization header. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/ListImport', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create an Email Message in C# and PHP Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Examples for sending a POST request to create a new email message using HttpClient in C# and Guzzle in PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/Message?sendDate={sendDate}&sendTestMessage={sendTestMessage}&sendReviewMessage={sendReviewMessage}&testEmailAddress={testEmailAddress}", new { Filter = null, BodyHtml = null, BodyText = null, CodePage = 0, EnablePassalong = false, EnableTracking = false, FromEmail = null, FromName = null, GoogleAnalyticsCampaignName = null, GoogleAnalyticsCampaignContent = null, ReplyEmail = null, ToName = null, EnableUniversalEmailKeySetting = false, CampaignId = 0, ExternalCampaignId = null, Subject = null }); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List/{listId}/Message', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### Delete Event Group Response Examples Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 Examples of successful and error responses when deleting an event group. ```json { "status": 200 } ``` ```json { "status": 400, "error": "ERROR_INVALID_PARAMETER", "message": "An invalid value was supplied for {Parameter}." } ``` ```json { "status": 404, "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", "message": "Unable to locate a resource associated with the listId and eventGroupId supplied." } ``` ```json { "status": 401, "error": "ERROR_UNAUTHORIZED", "message": "Authorization was denied for this request." } ``` -------------------------------- ### Get Profile Field Groups Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Retrieves a collection of profile field groups for a specified list using an HTTP GET request. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List/{listId}/SegmentationFieldGroup"); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/SegmentationFieldGroup', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create a Contact via Listrak API Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Examples for creating a contact in a specific list using C# and PHP. ```C# var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.PostAsJsonAsync("v1/List/{listId}/Contact?eventIds={eventIds}&overrideUnsubscribe={overrideUnsubscribe}&subscribedByContact={subscribedByContact}&sendDoubleOptIn={sendDoubleOptIn}&updateType={updateType}&newEmailAddress={newEmailAddress}", new { EmailAddress = null, SubscriptionState = null, ExternalContactID = null, SegmentationFieldValues = null }); ``` ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List/{listId}/Contact', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ``` -------------------------------- ### 404 NotFound Response Schema for Get Contact Source: https://api.listrak.com/email Schema for a not found response when getting a contact, indicating that the contact or list could not be located. ```json { "status": 404, "error": "ERROR_UNABLE_TO_LOCATE_RESOURCE", "message": "Unable to locate a resource associated with the listId and contactIdentifier supplied." } ``` -------------------------------- ### Create Folder - PHP Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113297001789539 Creates a new folder in your account. The request body should contain the folder details. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/Folder', [ 'json' => $folderResource, 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get All Campaigns (PHP) Source: https://api.listrak.com/email Utilize GuzzleHttp to send a GET request for campaign data. The Authorization header should be included in the request headers. ```php $client = new GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Campaign', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Get all Lists - C# Source: https://api.listrak.com/email Use this C# snippet to fetch all lists within your account. Ensure your HttpClient is configured with the correct base address and authorization token. ```csharp var client = new HttpClient(); client.BaseAddress = new Uri("https://api.listrak.com/email/"); client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token); var response = await client.GetAsync("v1/List"); ``` -------------------------------- ### Get All Conversations (PHP) Source: https://api.listrak.com/email Uses GuzzleHttp to send a GET request for retrieving conversations. Requires setting the base URI and Authorization header. ```php $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('GET', 'v1/List/{listId}/Conversation', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken] ]); ``` -------------------------------- ### Create a New List (PHP) Source: https://api.listrak.com/email/swagger/docs/v1?revision=639113296926747969 This PHP snippet demonstrates how to create a new list using Guzzle HTTP client. It includes setting the base URI and authorization headers. ```PHP $client = new \GuzzleHttp\Client([ 'base_uri' => 'https://api.listrak.com/email/' ]); $res = $client->request('POST', 'v1/List', [ 'headers' => ['Authorization' => 'Bearer ' . $accessToken], 'json' => $jsonBody ]); ```