LaGriffe Extranet API

This API allows authorized systems to manage marketing campaigns, customer groups, client assets and performance metrics across one or multiple stores belonging to the same customer group.


Authentication

All API requests must include a valid X-API-KEY header. This key identifies the customer group and defines the maximum access scope.

X-API-KEY: your-api-key

Optionally, requests can include an X-BEACON-KEY header to restrict access to a specific store (customer) within the group.

X-BEACON-KEY: external-beacon-uuid

Scoping Logic

The API automatically scopes data based on the provided headers:

If no beacon key is provided, data is aggregated at group level. All authorization checks are enforced server-side.


Available Endpoints

Campaigns

GET /api/campaigns

Returns the list of campaigns accessible within the current scope (group-level or store-level depending on headers).

curl -X GET https://api.extranet.lagriffe.test/api/campaigns \
  -H "X-API-KEY: your-api-key" \
  -H "Accept: application/json"
---

GET /api/campaigns/{id}

Returns detailed information for a single campaign, including:

Access is restricted by the same scoping rules (customer group and optional beacon key).

---

GET /api/campaigns/{id}/metrics

Returns performance metrics for a campaign, aggregated per channel and over time (impressions, clicks, conversions, spend, etc.).


Customer Groups

GET /api/customer-groups

Returns the list of customer groups associated with the API key. In most cases, a single customer group is returned.


Create a Campaign

POST /api/campaigns

Creates a new marketing campaign for a specific store and automatically generates an internal project.

Required payload (JSON or multipart):

{
  "external_beacon_key": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx",
  "label": "Google Ads – June",
  "channels": ["google_ads"],
  "period_type": "1_month",
  "budget_total": 1200,
  "start_date": "2025-06-01",
  "end_date": "2025-06-30"
}

The external_beacon_key uniquely identifies the store within the customer group and is mandatory for campaign creation.

Client assets (images, briefs, documents) can be uploaded at creation time using a multipart/form-data request with a files[] field.

curl -X POST https://api.extranet.lagriffe.test/api/campaigns \
  -H "X-API-KEY: your-api-key" \
  -H "Accept: application/json" \
  -F "external_beacon_key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxx" \
  -F "label=Google Ads – June" \
  -F "channels[]=google_ads" \
  -F "period_type=1_month" \
  -F "budget_total=1200" \
  -F "files[]=@brief.pdf" \
  -F "files[]=@banner.jpg"

Response Format

All successful responses are returned as JSON and follow a consistent structure.

{
  "success": true,
  "data": { }
}

Errors

In case of an error, the API returns an appropriate HTTP status code along with a JSON error message.

{
  "message": "Unauthorized"
}