All URIs are relative to https://developers.hostinger.com
| Method | HTTP request | Description |
|---|---|---|
| create_a_draft_campaign_v1 | POST /api/reach/v1/profiles/{profileUuid}/campaigns | Create a draft campaign |
| get_campaign_details_v1 | GET /api/reach/v1/profiles/{profileUuid}/campaigns/{campaignUuid} | Get campaign details |
| get_campaign_performance_v1 | GET /api/reach/v1/profiles/{profileUuid}/campaigns/{campaignUuid}/statistics | Get campaign performance |
| list_campaigns_v1 | GET /api/reach/v1/profiles/{profileUuid}/campaigns | List campaigns |
| send_campaign_v1 | POST /api/reach/v1/profiles/{profileUuid}/campaigns/{campaignUuid}/send | Send campaign |
| update_campaign_v1 | PATCH /api/reach/v1/profiles/{profileUuid}/campaigns/{campaignUuid} | Update campaign |
ReachV1CampaignsCreatedCampaignResource create_a_draft_campaign_v1(profile_uuid, reach_v1_campaigns_store_request)
Create a draft campaign
Create a campaign in a profile.
The campaign is created as a draft, so nothing is sent and no contact is touched. It has no audience yet either - targeting and scheduling are not part of this request, the draft is finished and sent from the Reach interface.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.reach_v1_campaigns_created_campaign_resource import ReachV1CampaignsCreatedCampaignResource
from hostinger_api.models.reach_v1_campaigns_store_request import ReachV1CampaignsStoreRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.ReachCampaignsApi(api_client)
profile_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Profile uuid parameter
reach_v1_campaigns_store_request = hostinger_api.ReachV1CampaignsStoreRequest() # ReachV1CampaignsStoreRequest |
try:
# Create a draft campaign
api_response = api_instance.create_a_draft_campaign_v1(profile_uuid, reach_v1_campaigns_store_request)
print("The response of ReachCampaignsApi->create_a_draft_campaign_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ReachCampaignsApi->create_a_draft_campaign_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| profile_uuid | str | Profile uuid parameter | |
| reach_v1_campaigns_store_request | ReachV1CampaignsStoreRequest |
ReachV1CampaignsCreatedCampaignResource
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ReachV1CampaignsCampaignDetailsResource get_campaign_details_v1(profile_uuid, campaign_uuid)
Get campaign details
Get a single campaign with its sender, subject, template reference, targeting and delivery progress.
This describes how the campaign was set up and how far it has got. For opens, clicks and
unsubscribes use the campaign statistics endpoint. The email content is not included: pass
template_uuid to the get email template endpoint to read its HTML.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.reach_v1_campaigns_campaign_details_resource import ReachV1CampaignsCampaignDetailsResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.ReachCampaignsApi(api_client)
profile_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Profile uuid parameter
campaign_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Campaign uuid parameter
try:
# Get campaign details
api_response = api_instance.get_campaign_details_v1(profile_uuid, campaign_uuid)
print("The response of ReachCampaignsApi->get_campaign_details_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ReachCampaignsApi->get_campaign_details_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| profile_uuid | str | Profile uuid parameter | |
| campaign_uuid | str | Campaign uuid parameter |
ReachV1CampaignsCampaignDetailsResource
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ReachV1CampaignsCampaignStatisticsResource get_campaign_performance_v1(profile_uuid, campaign_uuid)
Get campaign performance
Get the performance of a campaign: delivery, opens, clicks and unsubscribes, with the matching rates.
Every count is unique contacts rather than raw events, so a contact who opens the same email five times is counted once.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.reach_v1_campaigns_campaign_statistics_resource import ReachV1CampaignsCampaignStatisticsResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.ReachCampaignsApi(api_client)
profile_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Profile uuid parameter
campaign_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Campaign uuid parameter
try:
# Get campaign performance
api_response = api_instance.get_campaign_performance_v1(profile_uuid, campaign_uuid)
print("The response of ReachCampaignsApi->get_campaign_performance_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ReachCampaignsApi->get_campaign_performance_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| profile_uuid | str | Profile uuid parameter | |
| campaign_uuid | str | Campaign uuid parameter |
ReachV1CampaignsCampaignStatisticsResource
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ReachListCampaignsV1200Response list_campaigns_v1(profile_uuid, status=status, type=type, sort_direction=sort_direction, page=page, per_page=per_page)
List campaigns
Get a paginated list of the campaigns in a profile.
Each campaign carries its headline engagement rates. Filter by status to find drafts,
scheduled, sending or sent campaigns, keeping in mind that a fully sent campaign has the
status publish. By default only regular campaigns are returned - pass type to get the
emails sent by automations or the double opt-in confirmations instead.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.reach_list_campaigns_v1200_response import ReachListCampaignsV1200Response
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.ReachCampaignsApi(api_client)
profile_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Profile uuid parameter
status = 'publish' # str | Filter campaigns by status. A fully sent campaign has the status `publish`. There is no `sent` status, and campaigns can be neither paused nor archived. (optional)
type = campaign # str | Filter campaigns by type. Defaults to `campaign`, which leaves out the emails sent by automations and the double opt-in confirmations. (optional) (default to campaign)
sort_direction = 'desc' # str | Order campaigns by creation date. Newest first unless set to `asc`. (optional)
page = 1 # int | Page number (optional)
per_page = 25 # int | Number of items per page (optional) (default to 25)
try:
# List campaigns
api_response = api_instance.list_campaigns_v1(profile_uuid, status=status, type=type, sort_direction=sort_direction, page=page, per_page=per_page)
print("The response of ReachCampaignsApi->list_campaigns_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ReachCampaignsApi->list_campaigns_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| profile_uuid | str | Profile uuid parameter | |
| status | str | Filter campaigns by status. A fully sent campaign has the status `publish`. There is no `sent` status, and campaigns can be neither paused nor archived. | [optional] |
| type | str | Filter campaigns by type. Defaults to `campaign`, which leaves out the emails sent by automations and the double opt-in confirmations. | [optional] [default to campaign] |
| sort_direction | str | Order campaigns by creation date. Newest first unless set to `asc`. | [optional] |
| page | int | Page number | [optional] |
| per_page | int | Number of items per page | [optional] [default to 25] |
ReachListCampaignsV1200Response
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
CommonSuccessEmptyResource send_campaign_v1(profile_uuid, campaign_uuid)
Send campaign
Send a campaign now to the audience stored on it.
This is irreversible: once accepted, the emails go out and cannot be recalled. Confirm with the
customer before calling. The campaign needs a subject, sender, template and audience first - set
them with the update endpoint. Delivery is asynchronous, so success means accepted, not delivered:
the campaign moves to sending and later to publish, or to failed. Read the campaign to follow
it. The request is rejected when the campaign has no recipients, its sender domain is not verified
or is blocked, the plan's sending limits would be exceeded, or the campaign is already being sent.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.common_success_empty_resource import CommonSuccessEmptyResource
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.ReachCampaignsApi(api_client)
profile_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Profile uuid parameter
campaign_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Campaign uuid parameter
try:
# Send campaign
api_response = api_instance.send_campaign_v1(profile_uuid, campaign_uuid)
print("The response of ReachCampaignsApi->send_campaign_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ReachCampaignsApi->send_campaign_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| profile_uuid | str | Profile uuid parameter | |
| campaign_uuid | str | Campaign uuid parameter |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success empty response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ReachV1CampaignsCreatedCampaignResource update_campaign_v1(profile_uuid, campaign_uuid, reach_v1_campaigns_update_request)
Update campaign
Update a campaign's content, sender, template and audience.
Only draft, scheduled and failed campaigns can be updated; a campaign that is sending or
already sent is rejected. Updating a failed campaign moves it back to draft. Audience changes
replace rather than merge: all_contacts: true targets every contact of the profile, while
segment_uuids replaces the segments currently targeted. Leave both out to keep the audience as
it is. This does not send the campaign - use the send endpoint for that.
- Bearer Authentication (apiToken):
import hostinger_api
from hostinger_api.models.reach_v1_campaigns_created_campaign_resource import ReachV1CampaignsCreatedCampaignResource
from hostinger_api.models.reach_v1_campaigns_update_request import ReachV1CampaignsUpdateRequest
from hostinger_api.rest import ApiException
from pprint import pprint
# Configure Bearer authorization: apiToken
configuration = hostinger_api.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with hostinger_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = hostinger_api.ReachCampaignsApi(api_client)
profile_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Profile uuid parameter
campaign_uuid = '550e8400-e09b-41d4-a716-400055000000' # str | Campaign uuid parameter
reach_v1_campaigns_update_request = hostinger_api.ReachV1CampaignsUpdateRequest() # ReachV1CampaignsUpdateRequest |
try:
# Update campaign
api_response = api_instance.update_campaign_v1(profile_uuid, campaign_uuid, reach_v1_campaigns_update_request)
print("The response of ReachCampaignsApi->update_campaign_v1:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling ReachCampaignsApi->update_campaign_v1: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| profile_uuid | str | Profile uuid parameter | |
| campaign_uuid | str | Campaign uuid parameter | |
| reach_v1_campaigns_update_request | ReachV1CampaignsUpdateRequest |
ReachV1CampaignsCreatedCampaignResource
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success response | - |
| 422 | Validation error response | - |
| 401 | Unauthenticated response | - |
| 500 | Error response | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]