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

Documentation Index

Fetch the complete documentation index at: https://docs.targeter.tech/llms.txt

Use this file to discover all available pages before exploring further.

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 to that campaign.
  • If no campaign exists, the server stores context (including optional AI extraction). 201 typically includes ad_creation_link and campaign_id (hashed id) when automatic creation succeeds.
  • If automatic creation does not apply or fails, 201 may return only campaign_link (for example a prefilled creation flow).

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
array
required
One or more URLs to your client’s campaign assets (images or video). Each entry must be a valid URI.
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://storhaug.targeter.tech/api/campaign" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "source": {
      "material": ["https://client-assets.com/property.jpg"],
      "name": "Majorstuenveien 14",
      "reference_id": "CLIENT-PROP-123456",
      "target_url": "https://client-website.no/property/123"
    }
  }'

Response

Success (200) — existing campaign

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

Success (201) — new campaign flow

The response body is one of: Automatic creation succeeded — includes links to continue ad creation:
URL to continue ad creation for the new campaign
campaign_id
string
Hashed campaign id (same encoding as in app URLs)
{
    "ad_creation_link": "https://storhaug.targeter.tech/...",
    "campaign_id": "AbC123xyz"
}
Prefilled creation (no automatic creation) — link only:
URL to prefilled campaign creation when automatic creation is not used
{
    "campaign_link": "https://storhaug.targeter.tech/campaigns?create=true&source_id=WM-123456"
}

Error Responses

400 - Invalid request payload

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

401 - Unauthorized

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

500 - Server Error

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

Partner Usage Examples

Real Estate Campaign for Client

{
    "source": {
        "material": ["https://cdn.megler.no/bilde1.jpg", "https://cdn.megler.no/bilde2.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://cdn.megler.no/video.mp4"],
        "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 Asset URLs: Ensure all client material URLs are publicly accessible
  • Client Landing Pages: Verify that client target URLs are working and relevant
  • 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 app