### Get All Folders using Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ContactsApi.md This example demonstrates how to fetch all available folders using the Brevo PHP SDK. It requires API key configuration and proper SDK setup. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');// Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\ContactsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page $sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getFolders($limit, $offset, $sort); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->getFolders: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Configure API Key and Get Products - PHP Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/EcommerceApi.md Demonstrates how to configure API key authorization and retrieve products using the Brevo PHP SDK. Includes setup for both 'api-key' and 'partner-key'. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $limit = 50; // int | Number of documents per page $offset = 0; // int | Index of the first document in the page $sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed $ids = array ("ids_example"); // string[] | Filter by product ids $name = "name_example"; // string | Filter by product name, minimum 3 characters should be present for search $priceLte = 8.14; // float | Price filter for products less than and equals to particular amount $priceGte = 8.14; // float | Price filter for products greater than and equals to particular amount $priceLt = 8.14; // float | Price filter for products less than particular amount $priceGt = 8.14; // float | Price filter for products greater than particular amount $priceEq = 8.14; // float | Price filter for products equals to particular amount $priceNe = 8.14; // float | Price filter for products not equals to particular amount $categories = array ("categories_example"); // string[] | Filter by category ids $modifiedSince = "modifiedSince_example"; // string | Filter (urlencoded) the orders modified after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** $createdSince = "createdSince_example"; // string | Filter (urlencoded) the orders created after a given UTC date-time (YYYY-MM-DDTHH:mm:ss.SSSZ). **Prefer to pass your timezone in date-time format for accurate result.** try { $result = $apiInstance->getProducts($limit, $offset, $sort, $ids, $name, $priceLte, $priceGte, $priceLt, $priceGt, $priceEq, $priceNe, $categories, $modifiedSince, $createdSince); print_r($result); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getProducts: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get All Lists with Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ListsApi.md This example demonstrates how to fetch all lists with options for pagination and sorting. Default values are applied if parameters are omitted. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\ListsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page $sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getLists($limit, $offset, $sort); print_r($result); } catch (Exception $e) { echo 'Exception when calling ListsApi->getLists: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get Account Details using Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/README.md This example demonstrates how to configure API key authentication and fetch account details using the Brevo PHP SDK. Replace 'YOUR_API_KEY' with your actual API key. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\AccountApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); try { $result = $apiInstance->getAccount(); print_r($result); } catch (Exception $e) { echo 'Exception when calling AccountApi->getAccount: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get Email Campaign Statistics with Brevo PHP SDK Source: https://context7.com/getbrevo/brevo-php/llms.txt Retrieve detailed statistics for a specific email campaign using its ID. This example fetches global statistics. The Brevo SDK must be configured. ```php setApiKey('api-key', 'YOUR_API_KEY'); $apiInstance = new Brevo\Client\Api\EmailCampaignsApi( new GuzzleHttp\Client(), $config ); $campaignId = 123; $statistics = "globalStats"; // Get global statistics try { $result = $apiInstance->getEmailCampaign($campaignId, $statistics); echo "Campaign: " . $result->getName() . "\n"; echo "Status: " . $result->getStatus() . "\n"; $stats = $result->getStatistics()->getGlobalStats(); echo "Sent: " . $stats->getSent() . "\n"; echo "Delivered: " . $stats->getDelivered() . "\n"; echo "Opens: " . $stats->getUniqueOpens() . "\n"; echo "Clicks: " . $stats->getUniqueClicks() . "\n"; echo "Unsubscribes: " . $stats->getUnsubscriptions() . "\n"; echo "Bounces: " . $stats->getHardBounces() . "\n"; } catch (Exception $e) { echo 'Exception when calling EmailCampaignsApi->getEmailCampaign: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Install Brevo PHP SDK via Composer Source: https://context7.com/getbrevo/brevo-php/llms.txt Use Composer to install the Brevo PHP SDK. Ensure you specify the desired version. ```bash composer require getbrevo/brevo-php "1.x.x" ``` -------------------------------- ### Install Brevo PHP Library via Composer Source: https://github.com/getbrevo/brevo-php/blob/main/README.md Use Composer to add the Brevo PHP library to your project. Ensure you run `composer install` and include the autoloader. ```json { "require": { "getbrevo/brevo-php": "1.x.x" } } ``` ```bash composer require getbrevo/brevo-php "1.x.x" ``` -------------------------------- ### Get a Conversation Message - PHP Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ConversationsApi.md Retrieve a specific message from a conversation using its ID. This example includes API key setup and prints the retrieved message details. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\ConversationsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | ID of the message try { $result = $apiInstance->conversationsMessagesIdGet($id); print_r($result); } catch (Exception $e) { echo 'Exception when calling ConversationsApi->conversationsMessagesIdGet: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Create/Update Product with Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/EcommerceApi.md This example demonstrates how to create or update a product using the Brevo PHP SDK. It requires setting up API key authorization and initializing the EcommerceApi client. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $createUpdateProduct = new \Brevo\Client\Model\CreateUpdateProduct(); // \Brevo\Client\Model\CreateUpdateProduct | Values to create/update a product try { $result = $apiInstance->createUpdateProduct($createUpdateProduct); print_r($result); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createUpdateProduct: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### GET /senders/domains/{domainName} Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/DomainsApi.md Retrieves the configuration details for a specific domain. This is useful for validating domain setup. ```APIDOC ## GET /senders/domains/{domainName} ### Description Validates domain configuration. ### Method GET ### Endpoint /senders/domains/{domainName} ### Parameters #### Path Parameters - **domainName** (string) - Required - The domain name to validate. ### Response #### Success Response (200) - **body** (object) - Domain configuration details. #### Response Example ```json { "domainName": "example.com", "is_authenticated": true } ``` ``` -------------------------------- ### GET /getbrevo/brevo-php/getFolders Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ContactsApi.md Retrieves all available folders. You can control the number of results per page, the starting index, and the sort order. ```APIDOC ## GET /getbrevo/brevo-php/getFolders ### Description Retrieves all available folders. You can control the number of results per page, the starting index, and the sort order. ### Method GET ### Endpoint /getbrevo/brevo-php/getFolders ### Parameters #### Query Parameters - **limit** (int) - Optional - The number of documents per page. Defaults to 10. - **offset** (int) - Optional - The index of the first document of the page. Defaults to 0. - **sort** (string) - Optional - Sorts the results in ascending/descending order of record creation. Default order is descending if `sort` is not passed. Defaults to 'desc'. ### Response #### Success Response (200) - **Brevo\Client\Model\GetFolders** - An object containing the list of all folders. ``` -------------------------------- ### GET /folders Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/FoldersApi.md Retrieves a list of folders. You can control the number of results per page, the starting index, and the sort order. ```APIDOC ## GET /folders ### Description Retrieves a list of folders. You can control the number of results per page, the starting index, and the sort order. ### Method GET ### Endpoint /folders ### Parameters #### Query Parameters - **limit** (int) - Optional - Number of documents per page [default to 10] - **offset** (int) - Optional - Index of the first document of the page [default to 0] - **sort** (string) - Optional - Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed [default to desc] ### Request Example ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\FoldersApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $limit = 10; // int | Number of documents per page $offset = 0; // int | Index of the first document of the page $sort = "desc"; // string | Sort the results in the ascending/descending order of record creation. Default order is **descending** if `sort` is not passed try { $result = $apiInstance->getFolders($limit, $offset, $sort); print_r($result); } catch (Exception $e) { echo 'Exception when calling FoldersApi->getFolders: ', $e->getMessage(), PHP_EOL; } ?> ``` ### Response #### Success Response (200) - **folders** (array) - List of folders #### Response Example ```json { "folders": [ { "id": 123, "name": "My First Folder", "totalBlacklisted": 0, "totalUnsubscribed": 0, "totalContacts": 100 } ] } ``` ``` -------------------------------- ### POST /getbrevo/brevo-php/blob/main/examples/Contacts/createFolder.php Source: https://context7.com/getbrevo/brevo-php/llms.txt Create a folder to organize your contact lists. ```APIDOC ## Create Folder for Lists ### Description Create a folder to organize your contact lists. ### Method POST ### Endpoint /getbrevo/brevo-php/blob/main/examples/Contacts/createFolder.php ### Request Body - **name** (string) - Required - The name of the folder to be created. ### Request Example ```php setApiKey('api-key', 'YOUR_API_KEY'); $apiInstance = new Brevo\Client\Api\ContactsApi( new GuzzleHttp\Client(), $config ); $createFolder = new \Brevo\Client\Model\CreateUpdateFolder([ 'name' => 'Marketing Campaigns 2024' ]); try { $result = $apiInstance->createFolder($createFolder); echo "Folder created with ID: " . $result->getId() . "\n"; } catch (Exception $e) { echo 'Exception when calling ContactsApi->createFolder: ', $e->getMessage(), PHP_EOL; } ?> ``` ### Response #### Success Response (201) - **id** (integer) - The unique identifier of the newly created folder. #### Response Example ```json { "id": 123 } ``` ``` -------------------------------- ### Create List with Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ContactsApi.md This example demonstrates how to create a new list using the Brevo PHP SDK. It requires API key configuration and the autoloader to be included. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer');// Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\ContactsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Brevo\Client\Model\CreateList(); // \Brevo\Client\Model\CreateList | Values to create a list try { $result = $apiInstance->createList($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling ContactsApi->createList: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get All Contacts with Pagination Source: https://context7.com/getbrevo/brevo-php/llms.txt Retrieve all contacts from your account with pagination, filtering, and sorting options. Ensure the SDK is installed via Composer. ```php setApiKey('api-key', 'YOUR_API_KEY'); $apiInstance = new Brevo\Client\Api\ContactsApi( new GuzzleHttp\Client(), $config ); $limit = 50; // Number of contacts per page $offset = 0; // Starting index $modifiedSince = null; // Filter by modification date (optional) $createdSince = null; // Filter by creation date (optional) $sort = "desc"; // Sort order: asc or desc try { $result = $apiInstance->getContacts($limit, $offset, $modifiedSince, $createdSince, $sort); echo "Total Contacts: " . $result->getCount() . "\n"; foreach ($result->getContacts() as $contact) { echo "Email: " . $contact->getEmail() . "\n"; echo "ID: " . $contact->getId() . "\n"; } } catch (Exception $e) { echo 'Exception when calling ContactsApi->getContacts: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### GET /getbrevo/brevo-php/getFolderLists Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ContactsApi.md Retrieves a list of contacts within a specified folder. You can control the number of results per page, the starting index, and the sort order. ```APIDOC ## GET /getbrevo/brevo-php/getFolderLists ### Description Retrieves a list of contacts within a specified folder. You can control the number of results per page, the starting index, and the sort order. ### Method GET ### Endpoint /getbrevo/brevo-php/getFolderLists ### Parameters #### Query Parameters - **folderId** (int) - Required - The ID of the folder. - **limit** (int) - Optional - The number of documents per page. Defaults to 10. - **offset** (int) - Optional - The index of the first document of the page. Defaults to 0. - **sort** (string) - Optional - Sorts the results in ascending/descending order of record creation. Default order is descending if `sort` is not passed. Defaults to 'desc'. ### Response #### Success Response (200) - **Brevo\Client\Model\GetFolderLists** - An object containing the list of contacts within the folder. ``` -------------------------------- ### Validate Domain Configuration using Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/DomainsApi.md This example shows how to validate the configuration of a specific domain. It requires setting up API key authentication and initializing the DomainsApi. The result of the validation is printed. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\DomainsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $domainName = "domainName_example"; // string | Domain name try { $result = $apiInstance->getDomainConfiguration($domainName); print_r($result); } catch (Exception $e) { echo 'Exception when calling DomainsApi->getDomainConfiguration: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Run Unit Tests Source: https://github.com/getbrevo/brevo-php/blob/main/README.md Execute the library's unit tests after installation using Composer and PHPUnit. ```bash composer install ./vendor/bin/phpunit ``` -------------------------------- ### Get a CRM Task using Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/CRMApi.md Retrieve a specific CRM task by its ID. This example demonstrates how to fetch task details and print them. Ensure API keys are configured. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\CRMApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | try { $result = $apiInstance->crmTasksIdGet($id); print_r($result); } catch (Exception $e) { echo 'Exception when calling CRMApi->crmTasksIdGet: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Configure API Key Authorization Source: https://context7.com/getbrevo/brevo-php/llms.txt Include the autoloader after installation and configure the API key for authentication. Replace 'YOUR_API_KEY' with your actual Brevo API key. ```php setApiKey('api-key', 'YOUR_API_KEY'); ``` -------------------------------- ### Get Scheduled Email by Message ID - PHP Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/TransactionalEmailsApi.md Use this to retrieve details of a specific scheduled transactional email using its message ID. Requires message ID, start date, and end date. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\TransactionalEmailsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $messageId = "messageId_example"; // string | The messageId of scheduled email $startDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if endDate is used. Starting date (YYYY-MM-DD) from which you want to fetch the list. Can be maximum 30 days older tha current date. $endDate = new \DateTime("2013-10-20"); // \DateTime | Mandatory if startDate is used. Ending date (YYYY-MM-DD) till which you want to fetch the list. Maximum time period that can be selected is one month. try { $result = $apiInstance->getScheduledEmailByMessageId($messageId, $startDate, $endDate); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalEmailsApi->getScheduledEmailByMessageId: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Create API Key for Sub-Account with Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/MasterAccountApi.md This example shows how to generate a new API v3 key for a sub-account. It requires the `CreateApiKeyRequest` model. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\MasterAccountApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $createApiKeyRequest = new \Brevo\Client\Model\CreateApiKeyRequest(); // \Brevo\Client\Model\CreateApiKeyRequest | Values to generate API key for sub-account try { $result = $apiInstance->corporateSubAccountKeyPost($createApiKeyRequest); print_r($result); } catch (Exception $e) { echo 'Exception when calling MasterAccountApi->corporateSubAccountKeyPost: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### GET /account/activity Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/AccountApi.md Fetches account activity logs. You can filter the logs by providing a start and end date. The maximum time period that can be selected is one month, and logs from the past 12 months are available. ```APIDOC ## GET /account/activity ### Description Fetches account activity logs. You can filter the logs by providing a start and end date. The maximum time period that can be selected is one month, and logs from the past 12 months are available. ### Method GET ### Endpoint /account/activity ### Parameters #### Query Parameters - **startDate** (string) - Optional - Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. - **endDate** (string) - Optional - Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. - **limit** (int) - Optional - Number of documents per page. Default to 10. - **offset** (int) - Optional - Index of the first document in the page. Default to 0. ### Response #### Success Response (200) - ** Brevo\Client\Model\GetAccountActivity** - Description of the return type #### Response Example { "example": "response body" } ``` -------------------------------- ### Get Product Info with Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/EcommerceApi.md Retrieves detailed information for a specific product using its ID. Requires proper API key configuration. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | Product ID try { $result = $apiInstance->getProductInfo($id); print_r($result); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->getProductInfo: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get a Note using Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/NotesApi.md Retrieve a specific note by its ID. This example shows how to configure the API key and handle potential exceptions during the API call. The response includes the note details. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\NotesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | Note ID to get try { $result = $apiInstance->crmNotesIdGet($id); print_r($result); } catch (Exception $e) { echo 'Exception when calling NotesApi->crmNotesIdGet: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Create Batch Products with Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/EcommerceApi.md Use this snippet to create multiple products in a batch. Ensure API keys are configured correctly for authentication. This method is part of the EcommerceApi. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\EcommerceApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $createUpdateBatchProducts = new \Brevo\Client\Model\CreateUpdateBatchProducts(); // \Brevo\Client\Model\CreateUpdateBatchProducts | Values to create a batch of products try { $result = $apiInstance->createUpdateBatchProducts($createUpdateBatchProducts); print_r($result); } catch (Exception $e) { echo 'Exception when calling EcommerceApi->createUpdateBatchProducts: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Create New Domain with Brevo API Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/DomainsApi.md This PHP snippet demonstrates how to create a new domain using the Brevo API. It requires proper API key configuration and a domain object. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\DomainsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $domainName = new \Brevo\Client\Model\CreateDomain(); // \Brevo\Client\Model\CreateDomain | domain's name try { $result = $apiInstance->createDomain($domainName); print_r($result); } catch (Exception $e) { echo 'Exception when calling DomainsApi->createDomain: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get a Company by ID using Brevo PHP SDK Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/CompaniesApi.md Retrieve details of a specific company using its ID. This example demonstrates setting up API key authentication and handling the response, which includes company data or an exception. ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\CompaniesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $id = "id_example"; // string | try { $result = $apiInstance->companiesIdGet($id); print_r($result); } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesIdGet: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### POST /companies Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/CompaniesApi.md This snippet demonstrates how to create a new company using the Brevo PHP SDK. It includes API key configuration and an example of making the POST request. ```APIDOC ## POST /companies ### Description Creates a new company. ### Method POST ### Endpoint /companies ### Parameters #### Request Body - **body** (object) - Required - Company create data. ### Request Example ```php setApiKey('api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api-key', 'Bearer'); // Configure API key authorization: partner-key $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKey('partner-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = Brevo\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('partner-key', 'Bearer'); $apiInstance = new Brevo\Client\Api\CompaniesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Brevo\Client\Model\Body2(); // \Brevo\Client\Model\Body2 | Company create data. try { $result = $apiInstance->companiesPost($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling CompaniesApi->companiesPost: ', $e->getMessage(), PHP_EOL; } ?> ``` ### Response #### Success Response (200) - **InlineResponse2001** (object) - Details of the created company. #### Response Example ```json { "example": "response body" } ``` ### Authorization [api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ``` -------------------------------- ### GET /corporate/groups Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/MasterAccountApi.md Get the list of groups. ```APIDOC ## GET /corporate/groups ### Description Get the list of groups. ### Method GET ### Endpoint /corporate/groups ### Response #### Success Response (200) - **groups** (array) - List of groups - **id** (integer) - Group ID - **name** (string) - Group name - **isSubAccountOrganization** (boolean) - Whether the group is a sub-account organization - **createdAt** (string) - Creation date of the group - **updatedAt** (string) - Update date of the group ``` -------------------------------- ### GET /crm/tasktypes Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/TasksApi.md Get all task types. ```APIDOC ## GET /crm/tasktypes ### Description Get all task types. ### Method GET ### Endpoint /crm/tasktypes ### Response #### Success Response (200) - **TaskTypes** (\Brevo\Client\Model\TaskTypes) - ### Authorization [api-key](../../README.md#api-key), [partner-key](../../README.md#partner-key) ### HTTP request headers - **Accept**: application/json ``` -------------------------------- ### POST /folders Source: https://github.com/getbrevo/brevo-php/blob/main/docs/Api/ContactsApi.md Creates a new folder to organize your Brevo data. ```APIDOC ## POST /folders ### Description Create a folder ### Method POST ### Endpoint /folders ### Parameters #### Request Body - **body** (\Brevo\Client\Model\CreateFolder) - Required - Description of the request body ### Response #### Success Response (200) - **result** (\Brevo\Client\Model\CreateModel) - Description of the response body #### Response Example ```json { "example": "response body" } ``` ```