Campaigns
GET /establishments/[establishmentId]/campaigns
Retrieves all campaigns associated with a specific establishment. Useful for listing active, upcoming, and past campaigns in dashboards or reporting tools.
Endpoint
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
establishmentId | string | path | Sí |
Responses
200
Campaigns retrieved successfully.
400
Invalid establishment ID.
500
Server error while fetching campaigns.
POST /establishments/[establishmentId]/campaigns
Creates a new campaign for a given establishment. Supports multiple campaign types including daily rewards and tournaments, along with associated prize structures and targeting conditions.
Endpoint
Request Body
{
"title": "string" // required
"modalTitle": "string"
"description": "string"
"duration": "string"
"startDate": "string"
"endDate": "string"
"type": "string" // required
"multiplier": "integer"
"budget": "number"
"legalTerms": "string"
"termsAccepted": "boolean" // required
"prizes": "array" // required
"targeting": "object"
}
Atributo | Tipo | Requerido | Descripción |
---|---|---|---|
title | string | Sí | |
modalTitle | string | No | |
description | string | No | |
duration | string (next_weekend, next_week, next_month, next_year, custom) | No | |
startDate | string | No | |
endDate | string | No | |
type | string (daily_reward_simple, daily_reward_progressive, tournament) | Sí | |
multiplier | integer | No | |
budget | number | No | |
legalTerms | string | No | |
termsAccepted | boolean | Sí | |
prizes | array | Sí | |
targeting | object | No |
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
establishmentId | string | path | Sí |
Responses
200
Campaigns retrieved successfully.
[
{
"campaignId": "string"
"name": "string"
"modalTitle": "string"
"status": "string"
"type": "string"
"startDate": "string"
"endDate": "string"
"budget": "number"
"totalAwarded": "number"
"isTemplate": "boolean"
"duration": "string"
}
]
400
Invalid establishment ID.
500
Server error while fetching campaigns.
POST /establishments/[establishmentId]/campaigns/insert-activity
Triggers background processing or insertion of activity data related to campaigns for a specific establishment. Used for syncing or recalculating rewards.
Endpoint
Request Body
{
"mode": "string" // required
"player_id": "string" // required
"campaign_id": "string"
"amount": "number"
"bet_won": "boolean"
"bets_number": "number"
"referred_by": "string"
"login_time": "string"
"points": "integer"
}
Atributo | Tipo | Requerido | Descripción |
---|---|---|---|
mode | string (player, campaign, session, tournament) | Sí | Tracking context for the event. Affects required fields. |
player_id | string | Sí | ID of the player performing the action. |
campaign_id | string | No | Optional campaign ID, required for some modes. |
amount | number | No | Optional monetary amount involved in the action. |
bet_won | boolean | No | Flag indicating if the bet was won. |
bets_number | number | No | Number of bets made in the session or event. |
referred_by | string | No | Referrer ID. Required if mode is 'player'. |
login_time | string | No | Login timestamp in 'Y-m-d H:i:s'. Required if mode is 'session'. |
points | integer | No | Point value awarded or logged. Required if mode is 'tournament'. |
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
establishmentId | string | path | Sí |
Responses
200
Activity inserted or task triggered successfully.
400
Invalid request parameters.
500
Internal server error while inserting activity.
GET /establishments/[establishmentId]/campaigns/[campaignId]
Retrieves a specific campaign by ID for a given establishment. Returns full campaign configuration including rules, prizes, and targeting.
Endpoint
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
campaignId | string | path | Sí | |
establishmentId | string | path | Sí |
Responses
200
Campaign data retrieved successfully.
400
Invalid campaign or establishment ID.
500
Error while retrieving campaign.
PUT /establishments/[establishmentId]/campaigns/[campaignId]
Updates a campaign's configuration such as prizes, dates, or rules. The full campaign object should be re-sent with updated values.
Endpoint
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
establishmentId | string | path | Sí | |
campaignId | string | path | Sí |
Responses
200
Campaign updated successfully.
400
Invalid or incomplete update request.
500
Server error during campaign update.
DELETE /establishments/[establishmentId]/campaigns/[campaignId]
Deletes a campaign identified by ID from a given establishment. This operation is irreversible and may affect analytics or audit trails.
Endpoint
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
campaignId | string | path | Sí | |
establishmentId | string | path | Sí |
Responses
200
Campaign deleted successfully.
400
Invalid campaign or establishment ID.
500
Error while deleting campaign.
PUT /establishments/[establishmentId]/campaigns/[campaignId]/update-status
Updates the current status of a campaign (e.g., cancel, pause, mark as in-progress). Status transition rules must be respected according to business logic.
Endpoint
Request Body
{
"status": "string" // required
}
Atributo | Tipo | Requerido | Descripción |
---|---|---|---|
status | string (cancelled, paused, in_progress) | Sí |
Parameters
Atributo | Descripcion | Tipo | Ubicación | Requerido |
---|---|---|---|---|
campaignId | string | path | Sí | |
establishmentId | string | path | Sí |
Responses
200
Campaign status updated successfully.
400
Invalid status update request.
500
Error occurred while updating campaign status.