Settings
Settings are used to represent the configuration of a campaign, ad set or ad. Settings include things like runtimes, budgets, objectives and other configuration options.
The Settings Model
The settings model of n_2 describes settings of campaigns, ad sets and ads independently of the platform they belong to. This allows you to manage settings of campaigns, ad sets and ads in a platform-agnostic way.
Properties
- Name
settingType
- Type
- string
- Description
The type of the setting. This is used to distinguish between different kinds of settings.
See the setting types section for a list of all possible values.
- Name
kind
- Type
- string
- Description
The kind of the setting. This is used to distinguish between different kinds of settings of the same type.
See the setting kinds section for a list of all possible values.
- Name
<CustomSettingFields>
- Type
- any
- Description
Custom fields that are specific to the setting type. See the setting types section for more information.
Example Object
{
"settingType": "TotalBudget",
"kind": "BudgetSettingKind",
"budget": 1000,
"currency": "EUR",
}
Retrieving settings
Retrieval of settings is not done via a dedicated endpoint, but rather settings are included in the response of the campaign, ad set and ad endpoints.
Creating or updating a setting
This endpoint allows you to update settings of a campaign, ad set or ad. If the setting does not exist yet, it will be created.
Path parameters
- Name
platform
- Type
- string
- Description
The platform of the corresponding resource. See the platforms page for a list of all possible values.
- Name
resource
- Type
- string
- Description
The type of the resource the setting belongs to. Possible values are
campaigns
,adsets
andads
.
- Name
resourceId
- Type
- string
- Description
The ID of the resource the setting belongs to.
Request body
- Name
settings
- Type
- list<Setting>
- Description
The settings to create or update. See the settings model section for more information on the structure of a setting. All fields of a setting are mandatory unless otherwise specified.
Request
curl https://api.n2api.io/v1/GoogleAds/campaigns/1234567 \
-X PUT \
-H "Authorization: Bearer {token}" \
-d '{
"settings": [
{
"settingType": "TotalBudget",
"kind": "BudgetSettingKind",
"budget": 1000,
"currency": "EUR",
},
]
}'
Response
{
"settings": [
{
"kind": "TotalBudget",
"budget": 1000,
"currency": "EUR",
},
{
"kind": "DailyBudget",
"budget": 100,
"currency": "EUR",
}
]
}
Notice that the response contains all settings of the campaign, ad set or ad, not just the ones that were updated.
Delete a setting
This endpoint allows you to delete a setting of a campaign, ad set or ad.
Notice that some settings are required by the platform and cannot be deleted. See the setting types section for more information.
Path parameters
- Name
platform
- Type
- string
- Description
The platform of the corresponding resource. See the platforms page for a list of all possible values.
- Name
resource
- Type
- string
- Description
The type of the resource the setting belongs to. Possible values are
campaigns
,adsets
andads
.
- Name
resourceId
- Type
- string
- Description
The ID of the resource the setting belongs to.
- Name
settingType
- Type
- string
- Description
The type of the setting to delete. See the setting types section for a list of all possible values.
Request
curl https://api.n2api.io/v1/GoogleAds/campaigns/1234567/settings/TotalBudget \
-X DELETE \
-H "Authorization: Bearer {token}"
Response
{
"deletions": 1,
}
Setting types
Retrieving setting types
This endpoint allows you to retrieve all setting types that are supported by n_2. Along with the setting type, the endpoint also returns the corresponding mandatory fields.
Query parameters
The following query parameters are optional. If they are not specified, all setting types are returned.
- Name
platforms
- Type
- list<string>
- Description
The platforms to filter by. See the platforms page for a list of all possible values.
- Name
resources
- Type
- list<string>
- Description
The resources to filter by. Possible values are
campaigns
,adsets
andads
.
Request
curl https://api.n2api.io/v1/settings \
-X GET \
-H "Authorization: Bearer {token}" \
-d '{
"platform": "GoogleAds",
"resource": "adsets",
}'
Response
[
{
"settingType": "TotalBudget",
"kind": "BudgetSettingKind",
"fields": [
{
"name": "budget",
"type": "number",
"required": true,
},
{
"name": "currency",
"type": "string",
"required": true,
},
],
},
{
"settingType": "DailyBudget",
"kind": "BudgetSettingKind",
"fields": [
{
"name": "budget",
"type": "number",
"required": true,
},
{
"name": "currency",
"type": "string",
"required": true,
},
],
},
{
"settingType": "FrequenyCapping",
"kind": "FrequencyCappingSettingKind",
"fields": [
{
"name": "time",
"type": "number",
"required": true,
},
{
"name": "requests",
"type": "number",
"required": true,
}
],
},
{
"settingType": "MaximumCPM",
"kind": "BidSettingKind",
"fields": [
{
"name": "maximumCPM",
"type": "number",
"required": true,
},
{
"name": "currency",
"type": "string",
"required": true,
},
],
}
...
]