# Get trigger source by ID

Retrieve a specific trigger source with its configuration

Endpoint: GET /trigger-sources/{id}
Version: 2.0.62
Security: authJWT

## Security:

  - `authJWT` (unknown)
    http bearer JWT

## Path parameters:

  - `id` (string, required)
    Trigger source ID

## Query parameters:

  - `include` (string)
    Pass `translations` to include the raw per-locale translations map (admin editing).

## Header parameters:

  - `x-locale` (string)
    Optional BCP 47 locale (e.g. `de`, `de-AT`). Translatable fields are returned in this locale, falling back per field to the base text; the fields that came from a translation are listed in `localizedFields`. Absent or invalid values are ignored. `Accept-Language` is deliberately not used (browsers send it on every request, and localization must stay opt-in so editing flows keep reading base text) and no `Content-Language` is sent (a response can mix localized and base text).

## Response 200:

  - `200` (unknown)
    Trigger source retrieved successfully

## Response 200 fields (application/json):

  - `type` (string, required)
    Type of trigger source - HOW to claim rewards.
**Available Types:**
- `QR_CODE`
: Physical QR code scan. App opens camera, decodes QR, extracts triggerSourceId
- `NFC_TAG`
: NFC tag tap. App activates NFC reader, reads tag data
- `GPS_GEOFENCE`
: GPS-based geofence. App sends user coordinates for proximity validation
- `API_WEBHOOK`
: Server-to-server webhook. External system triggers claim via API
- `TRANSACTION`
: Purchase/transaction triggered. Claim activated by payment events

**Important:** This defines HOW claims are triggered (the touchpoint mechanism).
NOT to be confused with CampaignTriggerType which defines WHO can claim (CLAIM_BY_USER, CLAIM_BY_BUSINESS, CLAIM_BY_SYSTEM).
**App Integration:**

```typescript
const triggerTypes = campaign.included?.triggerSources?.map(ts => ts.type);
// Based on types, show appropriate UI (camera for QR, NFC prompt, location request, etc.)
```
    Enum: "QR_CODE", "NFC_TAG", "API_WEBHOOK", "GPS_GEOFENCE", "TRANSACTION"

  - `name` (string, required)
    Human-readable name for the trigger source
    Example: Main Entrance QR Code

  - `description` (number)
    Optional description explaining this trigger source
    Example: QR code located at the main entrance for visitor check-in

  - `metadata` (object)
    Type-specific configuration: `tokenConfig` (override token ID). See TriggerSourceMetadata interface.
    Example: {"tokenConfig":{"tokenId":"1"}}

  - `context` (object)
    **ERC721 only** - Admin-controlled dynamic context for template interpolation and AI prompts. This data is ALWAYS applied (not subject to allowExternalContextOverwrite).
**Template Interpolation:** Values become available as `{{context.keyName}}` placeholders in TokenMetadata name/description fields and AI prompts.
**Special validity keys:**
- `validityDate`
 - Base date for trigger-based validity
- `validityEndDate`
 - End date for date ranges (e.g., hotel checkout)
- `validityDuration`
 - Override duration in days/hours

**Custom keys:** Any arbitrary key becomes `{{context.keyName}}` placeholder.
**Use cases:**
- QR at hotel room:
`{ location: "Room 305", roomType: "Suite" }`
- NFC at event entrance:
`{ eventName: "Summer Festival", zone: "VIP" }`
- Kiosk-specific:
`{ deviceId: "kiosk-001", branch: "Downtown" }`
    Example: {"location":"Main Lobby","deviceId":"kiosk-001","validityDate":"2026-04-20T11:00:00Z"}

  - `maxUsage` (number)
    Maximum usage limit. null=unlimited, 1=single-use (receipt), 100=limited edition. Usage count calculated from claims via CQRS.
    Example: null

  - `expiresAt` (string)
    Expiration timestamp. After this date, claims through this source are rejected regardless of maxUsage. null=no expiry (permanent). Also used by the periodic cleanup job to soft-delete stale sources.
    Example: 2026-12-31T23:59:59Z

  - `multiplier` (number)
    Reward multiplier applied to claims through this specific source (e.g. a VIP entrance NFC tag worth 3x). Takes precedence over CampaignClaimRequestDTO.multiplier; still capped by CampaignTrigger.maxMultiplier. null=no source-specific override.
    Example: 2

  - `businessId` (number)
    Reference to the business that owns this trigger source. Optional - can be tenant-wide trigger sources
    Example: business-uuid-123

  - `campaignId` (string)
    ID of the campaign this trigger source is currently assigned to (null = unassigned/available). Set either at creation via TriggerSourceCreateRequestDTO.campaignId, or afterward via the campaign assign/remove trigger-source endpoints.
    Example: null

  - `coordsLatitude` (number)
    Latitude. Geographic coordinates for location-based trigger validation.
**Universal Location Support:** ANY trigger type can use proximity validation (GPS_GEOFENCE, QR_CODE, NFC_TAG, API_WEBHOOK, TRANSACTION).
**Location Resolution Priority:**
1. TriggerSource coordinates (if set)
2. Business coordinates (if businessId exists)
3. Neither - No location validation

Distance constraints defined in CampaignTrigger.maxGeoDistanceInMeters. Both latitude and longitude must be provided together.
**Geocoding behavior:** Changing coords will auto-update address fields. To adjust pin position without changing address (e.g., parking entrance), set BOTH coordinates AND address fields in the same request.
    Example: 47.6062

  - `coordsLongitude` (number)
    Longitude. Geographic coordinates for location-based trigger validation.
**Universal Location Support:** ANY trigger type can use proximity validation (GPS_GEOFENCE, QR_CODE, NFC_TAG, API_WEBHOOK, TRANSACTION).
**Location Resolution Priority:**
1. TriggerSource coordinates (if set)
2. Business coordinates (if businessId exists)
3. Neither - No location validation

Distance constraints defined in CampaignTrigger.maxGeoDistanceInMeters. Both latitude and longitude must be provided together.
    Example: -122.3321

  - `streetAddress` (string)
    Street address (auto-populated from geocoding if coordinates provided)
    Example: 123 Main Street

  - `neighborhood` (string)
    Neighborhood/area name (e.g., "West Bay", "Pearl Qatar", "Lusail") - auto-populated from geocoding
    Example: West Bay

  - `district` (string)
    District/administrative area - auto-populated from geocoding
    Example: Doha Municipality

  - `city` (string)
    City. Auto-populated from geocoding if only coordinates provided. **Geocoding behavior:** Changing address fields will auto-update coordinates. To adjust pin without changing address, set BOTH coords AND address fields.
    Example: Doha

  - `postalCode` (string)
    Postal code (auto-populated from geocoding if coordinates provided)
    Example: 12345

  - `country` (string)
    Country (auto-populated from geocoding if coordinates provided)
    Example: Qatar

  - `countryCode` (string)
    ISO 3166-1 alpha-2 country code (auto-populated from geocoding)
    Example: QA

  - `translations` (object)
    Per-locale translations of the translatable fields, keyed by locale. Only returned with include=translations.
    Example: {"de":{"name":"..."},"fr":null}

  - `id` (string, required)
    Unique identifier for the trigger source
    Example: source-12345

  - `isActive` (boolean, required)
    Whether this trigger source is currently active. Inactive sources won't trigger any flows
    Example: true

  - `isExhausted` (boolean, required)
    Whether this trigger source has been exhausted (agotado). Set via CQRS when claim count reaches maxUsage.

  - `createdAt` (object, required)
    Timestamp when the trigger source was created
    Example: 2024-01-01T12:00:00.000Z

  - `updatedAt` (object, required)
    Timestamp when the trigger source was last updated
    Example: 2024-01-10T12:00:00.000Z

## Response 404:

  - `404` (unknown)
    Trigger source not found

