Add Search ad-group keywords
curl --request POST \
--url https://api.aisa.one/apis/v1/ads/keywords \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"adSetId": "1234567890",
"keywords": [
"example"
]
}
'import requests
url = "https://api.aisa.one/apis/v1/ads/keywords"
payload = {
"adSetId": "1234567890",
"keywords": ["example"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({adSetId: '1234567890', keywords: ['example']})
};
fetch('https://api.aisa.one/apis/v1/ads/keywords', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/ads/keywords",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adSetId' => '1234567890',
'keywords' => [
'example'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/ads/keywords"
payload := strings.NewReader("{\n \"adSetId\": \"1234567890\",\n \"keywords\": [\n \"example\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/ads/keywords")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adSetId\": \"1234567890\",\n \"keywords\": [\n \"example\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/ads/keywords")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adSetId\": \"1234567890\",\n \"keywords\": [\n \"example\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"keywords": [
{
"adAccountId": "<string>",
"adSetId": "<string>",
"adSetName": "<string>",
"adSetStatus": "<string>",
"campaignId": "<string>",
"campaignName": "<string>",
"campaignStatus": "<string>",
"connectionId": "<string>",
"id": "<string>",
"keyword": "<string>",
"matchType": "exact",
"metrics": {
"clicks": 123,
"conversions": 123,
"cost": 123,
"firstPageCpc": 123,
"firstPositionCpc": 123,
"impressions": 123,
"windowDays": 123
},
"negative": true,
"platform": "google",
"platformCriterionId": "<string>",
"quality": {
"adRelevance": "BELOW_AVERAGE",
"expectedCtr": "BELOW_AVERAGE",
"landingPageExperience": "BELOW_AVERAGE",
"score": 123
},
"qualityScore": 123,
"resourceName": "<string>",
"status": "active",
"syncedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}Keywords
Add Search ad-group keywords
Ad Campaigns. Can spend money or change spend: needs the ads:spend scope and X-Aisa-Confirm: spend; without the header the request is refused with confirmation_required and nothing is sent. Adds keywords an ad group bids on. Adds keywords, or negative keywords, to a Google Search ad group without replacing the ones already there. Adds one or more keyword criteria to an existing Google Search ad group, without touching the keywords already there (unlike the whole-set diff on PUT /apis/v1/ads/{adId}, keywords/negativeKeywords in platformSpecificData, which replaces the set).
POST
https://api.aisa.one
/
apis
/
v1
/
ads
/
keywords
Add Search ad-group keywords
curl --request POST \
--url https://api.aisa.one/apis/v1/ads/keywords \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"adSetId": "1234567890",
"keywords": [
"example"
]
}
'import requests
url = "https://api.aisa.one/apis/v1/ads/keywords"
payload = {
"adSetId": "1234567890",
"keywords": ["example"]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({adSetId: '1234567890', keywords: ['example']})
};
fetch('https://api.aisa.one/apis/v1/ads/keywords', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/ads/keywords",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'adSetId' => '1234567890',
'keywords' => [
'example'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/ads/keywords"
payload := strings.NewReader("{\n \"adSetId\": \"1234567890\",\n \"keywords\": [\n \"example\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.aisa.one/apis/v1/ads/keywords")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"adSetId\": \"1234567890\",\n \"keywords\": [\n \"example\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/ads/keywords")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"adSetId\": \"1234567890\",\n \"keywords\": [\n \"example\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"keywords": [
{
"adAccountId": "<string>",
"adSetId": "<string>",
"adSetName": "<string>",
"adSetStatus": "<string>",
"campaignId": "<string>",
"campaignName": "<string>",
"campaignStatus": "<string>",
"connectionId": "<string>",
"id": "<string>",
"keyword": "<string>",
"matchType": "exact",
"metrics": {
"clicks": 123,
"conversions": 123,
"cost": 123,
"firstPageCpc": 123,
"firstPositionCpc": 123,
"impressions": 123,
"windowDays": 123
},
"negative": true,
"platform": "google",
"platformCriterionId": "<string>",
"quality": {
"adRelevance": "BELOW_AVERAGE",
"expectedCtr": "BELOW_AVERAGE",
"landingPageExperience": "BELOW_AVERAGE",
"score": 123
},
"qualityScore": 123,
"resourceName": "<string>",
"status": "active",
"syncedAt": "2023-11-07T05:31:56Z"
}
]
}{
"error": {
"code": "<string>",
"details": {},
"message": "<string>",
"param": "<string>",
"retryHint": "<string>",
"retryable": true,
"type": "<string>"
}
}Request contract
- Method and path: POST /apis/v1/ads/keywords
- Availability: enabled
- Request URL template:
https://api.aisa.one/apis/v1/ads/keywords - connectionId: query; required
- X-Aisa-Confirm: header; optional
{
"operationId": "post_aisa_ads_apis_v1_ads_keywords",
"method": "POST",
"path": "/apis/v1/ads/keywords",
"servers": [
{
"url": "https://api.aisa.one"
}
],
"parameters": [
{
"description": "The ads connection (adc_...) the request runs on: one of yours, from GET /apis/v1/ads/connections. On a request with a JSON body it may be sent as a top-level body member instead.",
"in": "query",
"name": "connectionId",
"required": true,
"schema": {
"pattern": "^adc_[0-9A-Za-z]+$",
"type": "string"
}
},
{
"description": "Required with the value \"spend\" when the request can spend money or change spend. Without it the request is refused with 409 confirmation_required, which describes what would happen; nothing is sent to the ad platform.",
"in": "header",
"name": "X-Aisa-Confirm",
"required": false,
"schema": {
"enum": [
"spend"
],
"type": "string"
}
}
],
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"content": {
"application/json": {
"example": {
"adSetId": "1234567890",
"connectionId": "adc_7f3k2m9q",
"keywords": [
"example"
]
},
"schema": {
"additionalProperties": true,
"properties": {
"adSetId": {
"description": "Google ad group ID to add the keywords to Must be yours: it is checked through the connection before the request is sent, and an id that is not yours answers not_found.",
"type": "string"
},
"connectionId": {
"description": "The ads connection (adc_...), when not sent as the connectionId query parameter.",
"pattern": "^adc_[0-9A-Za-z]+$",
"type": "string"
},
"keywords": {
"items": {
"anyOf": [
{
"description": "Keyword text; defaults to BROAD match",
"type": "string"
},
{
"properties": {
"matchType": {
"enum": [
"exact",
"phrase",
"broad"
],
"type": "string"
},
"text": {
"maxLength": 80,
"minLength": 1,
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
}
]
},
"maxItems": 1000,
"minItems": 1,
"type": "array"
},
"negative": {
"default": false,
"description": "Add as ad-group-level negatives instead of positive keywords",
"type": "boolean"
}
},
"required": [
"adSetId",
"keywords"
],
"type": "object"
}
}
},
"required": true
},
"x-aisa-status": "enabled",
"components": {
"securitySchemes": {
"bearerAuth": {
"scheme": "bearer",
"type": "http"
}
}
}
}
Cost and request rules
No additional charge for this operation. Ad spend is billed separately by the ad platform to your connected ad account.Authorizations
Headers
Query Parameters
Body
application/json