Skip to main content
POST
/
campaign
Create or resolve campaign from external source
curl --request POST \
  --url https://app.targeter.tech/api/campaign \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "source": {
    "material": [
      "https://example.com/image1.jpg"
    ],
    "name": "Majorstuenveien 14",
    "reference_id": "CLIENT-PROP-123456",
    "target_url": "https://client-website.no/property/123"
  }
}
'
import requests

url = "https://app.targeter.tech/api/campaign"

payload = { "source": {
"material": ["https://example.com/image1.jpg"],
"name": "Majorstuenveien 14",
"reference_id": "CLIENT-PROP-123456",
"target_url": "https://client-website.no/property/123"
} }
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({
source: {
material: ['https://example.com/image1.jpg'],
name: 'Majorstuenveien 14',
reference_id: 'CLIENT-PROP-123456',
target_url: 'https://client-website.no/property/123'
}
})
};

fetch('https://app.targeter.tech/api/campaign', 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://app.targeter.tech/api/campaign",
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([
'source' => [
'material' => [
'https://example.com/image1.jpg'
],
'name' => 'Majorstuenveien 14',
'reference_id' => 'CLIENT-PROP-123456',
'target_url' => 'https://client-website.no/property/123'
]
]),
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://app.targeter.tech/api/campaign"

payload := strings.NewReader("{\n \"source\": {\n \"material\": [\n \"https://example.com/image1.jpg\"\n ],\n \"name\": \"Majorstuenveien 14\",\n \"reference_id\": \"CLIENT-PROP-123456\",\n \"target_url\": \"https://client-website.no/property/123\"\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://app.targeter.tech/api/campaign")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"source\": {\n \"material\": [\n \"https://example.com/image1.jpg\"\n ],\n \"name\": \"Majorstuenveien 14\",\n \"reference_id\": \"CLIENT-PROP-123456\",\n \"target_url\": \"https://client-website.no/property/123\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://app.targeter.tech/api/campaign")

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 \"source\": {\n \"material\": [\n \"https://example.com/image1.jpg\"\n ],\n \"name\": \"Majorstuenveien 14\",\n \"reference_id\": \"CLIENT-PROP-123456\",\n \"target_url\": \"https://client-website.no/property/123\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "campaign_link": "https://app.targeter.tech/campaigns/AbC123xyz"
}

Overview

Submit campaign source data keyed by reference_id. Requires a valid Bearer token from POST /auth/token.
  • If a campaign already exists for reference_id, the API returns 200 with campaign_link.
  • If no campaign exists, the server stores context (including optional AI extraction), creates the campaign, and returns 201 with campaign_link and campaign_id.
Use campaign_id with GET /campaign to fetch the campaign, its stats, and an app link.

Request

Headers

  • Authorization: Bearer {jwt_token} (required — obtained using your issued partner credentials)
  • Content-Type: application/json

Body Parameters

source
object
required
Container for campaign source metadata for your client
source.material
string[]
required
Image URLs for the campaign (at least one required)
source.name
string
required
Campaign display name (for example property address)
source.reference_id
string
required
Your stable external id for this campaign
source.target_url
string
required
Landing page URL (URI)

Example Request

curl -X POST "https://app.targeter.tech/api/campaign" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source": {
      "material": [
        "https://example.com/image1.jpg"
      ],
      "name": "Majorstuenveien 14",
      "reference_id": "CLIENT-PROP-123456",
      "target_url": "https://client-website.no/property/123"
    }
  }'

Response

Success (201 — new campaign)

URL to the campaign in the Targeter app
campaign_id
string
Campaign id (hashed id, same encoding as in app URLs)
{
    "campaign_link": "https://app.targeter.tech/campaigns/AbC123xyz",
    "campaign_id": "AbC123xyz"
}

Success (200 — existing campaign)

URL to the existing campaign in the Targeter app
{
    "campaign_link": "https://app.targeter.tech/campaigns/AbC123xyz"
}

Error Responses

400 - Invalid request payload

{
    "error": "Missing required field: source.reference_id: Reference ID is required"
}
Validation errors on auth may include a details array with path and message per field.

401 - Unauthorized

Missing Authorization header, or invalid or expired token.
{
    "error": "Missing or invalid Authorization header"
}
{
    "error": "Invalid or expired token"
}

500 - Server Error

{
    "error": "Unexpected server error. Please try again later."
}

Partner Usage Examples

Real Estate Campaign for Client

{
    "source": {
        "material": [
            "https://example.com/property-photo.jpg"
        ],
        "name": "Ivan Bjørndals Gate 9",
        "reference_id": "123-456-789",
        "target_url": "https://megler.no/eiendom/123"
    }
}

Marketing Campaign for Client

{
    "source": {
        "material": [
            "https://example.com/campaign-hero.jpg"
        ],
        "name": "Sommerkampanje Torshov",
        "reference_id": "TORSHOV-SUMMER-01012025-123",
        "target_url": "https://megler.no/kontor/torshov"
    }
}

Partner Best Practices

  • Unique Reference IDs: Use unique, meaningful reference IDs from your system to avoid conflicts
  • Client Landing Pages: Verify that client target URLs are working and relevant
  • Image URLs: Provide publicly accessible image URLs in material
  • Error Handling: Always check response status codes and handle errors appropriately
  • Client Consent: Ensure you have proper authorization to create campaigns on behalf of your clients

Authorizations

Authorization
string
header
required

Use Authorization: Bearer <token>. Obtain the token from POST /auth/token.

Body

application/json
source
object
required

Campaign source metadata for the client

Response

Campaign already exists for the given reference_id

URL to the existing campaign in the Targeter app

Example:

"https://app.targeter.tech/campaigns/AbC123xyz"