Smartico API Documentation
This documentation describes the ThePowerPlugin API, a comprehensive platform for managing casinos and gaming establishments. The API allows you to efficiently manage establishments, players, products, and orders.
Authentication
All API requests require authentication using a Bearer token in the Authorization
header.
Authorization: Bearer your_token_here
Base URL
https://stageapi.thepowerplugin.com/
HTTP Status Codes
Code | Description |
---|---|
200 | Success - Request processed successfully |
201 | Created - Resource created successfully |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid authentication token |
403 | Forbidden - No permissions to access resource |
404 | Not Found - Requested resource does not exist |
409 | Conflict - Resource already exists or conflict occurred |
500 | Internal Server Error |
Establishments
Establishments represent the casinos or gaming venues that use the Smartico platform.
GET /establishments/{establishmentId}
Gets detailed information about a specific establishment.
Endpoint
Description
This endpoint allows you to retrieve all information associated with an establishment, including basic data, configuration, and current status.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
establishmentId | Unique establishment identifier | string | path | Yes |
Request Example
curl -X GET "https://stageapi.thepowerplugin.com//establishments/est_123456" \
-H "Authorization: Bearer your_token_here"
Responses
200 - Success
Establishment found successfully.
{
"id": "est_123456",
"name": "Casino Royal Madrid",
"address": {
"street": "Calle Gran Vía 123",
"city": "Madrid",
"postalCode": "28013",
"country": "Spain"
},
"contact": {
"email": "info@casinoroyal.com",
"phone": "+34 91 123 4567"
},
"status": "active",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-20T14:22:00Z",
"settings": {
"currency": "EUR",
"timezone": "Europe/Madrid",
"language": "en"
}
}
400 - Bad Request
Error in request parameters.
{
"error": "INVALID_PARAMETERS",
"message": "establishmentId must be a valid string",
"code": 400
}
404 - Not Found
The establishment does not exist or you don't have permissions to access it.
{
"error": "ESTABLISHMENT_NOT_FOUND",
"message": "Establishment with ID est_123456 not found",
"code": 404
}
500 - Server Error
Internal server error.
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
Orders
Orders represent product purchase transactions by players in establishments.
POST /orders/request
Requests a product reservation for a specific player.
Endpoint
Description
This endpoint allows a player to request a product reservation in an establishment. The system will verify product availability and create a pending transaction.
Request Body
{
"productId": "prod_789012", // required
"playerId": "player_345678", // required
"establishmentId": "est_123456" // required
}
Request Body Parameters
Attribute | Type | Required | Description |
---|---|---|---|
productId | string | Yes | Unique identifier of the product to reserve |
playerId | string | Yes | Unique identifier of the player requesting the reservation |
establishmentId | string | Yes | Unique identifier of the establishment where the reservation is made |
Request Example
curl -X POST "https://stageapi.thepowerplugin.com//orders/request" \
-H "Authorization: Bearer your_token_here" \
-H "Content-Type: application/json" \
-d '{
"productId": "prod_789012",
"playerId": "player_345678",
"establishmentId": "est_123456"
}'
Responses
200 - Product Reserved Successfully
The reservation has been processed successfully.
{
"message": "Product reserved successfully. Please request end user shipping details.",
"transactionId": "7c02e8e3-9f29-43c1-9c89-4f7fa5d42c77",
"digital": false,
"trackUrl": "https://subdomain.thepowerplugin.com/orders/request-ship/abc123",
"orderDetails": {
"product": {
"id": "prod_789012",
"name": "iPhone 15 Pro",
"price": 1199.99,
"currency": "EUR"
},
"player": {
"id": "player_345678",
"name": "John Doe"
},
"establishment": {
"id": "est_123456",
"name": "Casino Royal Madrid"
},
"reservedAt": "2024-01-20T15:30:00Z",
"expiresAt": "2024-01-21T15:30:00Z"
}
}
400 - Bad Request or Validation Error
Error in sent data or validation failed.
{
"error": "VALIDATION_ERROR",
"message": "The provided data is not valid",
"details": [
{
"field": "productId",
"message": "productId is required"
}
],
"code": 400
}
404 - Resource Not Found
The product, player, or establishment does not exist.
{
"error": "RESOURCE_NOT_FOUND",
"message": "Product with ID prod_789012 not found",
"code": 404
}
409 - Conflict
The product is not available or already reserved.
{
"error": "PRODUCT_UNAVAILABLE",
"message": "The requested product is not available at this time",
"code": 409
}
500 - Internal Server Error
Internal server error.
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
Players
Players are users who participate in games and can make purchases in establishments.
GET /players
Gets a paginated list of all players.
Endpoint
Description
This endpoint allows you to retrieve a list of players with pagination and optional filters.
Query Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
page | Page number (default: 1) | integer | query | No |
limit | Items per page (default: 20, max: 100) | integer | query | No |
establishmentId | Filter by specific establishment | string | query | No |
status | Filter by player status (active, inactive, suspended) | string | query | No |
Request Example
curl -X GET "https://stageapi.thepowerplugin.com//players?page=1&limit=10&establishmentId=est_123456" \
-H "Authorization: Bearer your_token_here"
Responses
200 - Players List Retrieved Successfully
{
"players": [
{
"id": "player_345678",
"name": "John Doe",
"email": "john.doe@email.com",
"phone": "+34 600 123 456",
"status": "active",
"establishmentId": "est_123456",
"totalSpent": 2500.50,
"currency": "EUR",
"createdAt": "2024-01-10T09:15:00Z",
"lastActivity": "2024-01-20T14:30:00Z"
}
],
"pagination": {
"currentPage": 1,
"totalPages": 5,
"totalItems": 47,
"itemsPerPage": 10
}
}
400 - Invalid Parameters
{
"error": "INVALID_PARAMETERS",
"message": "The 'limit' parameter cannot be greater than 100",
"code": 400
}
POST /players
Creates a new player in the system.
Endpoint
Description
Registers a new player in the Smartico platform.
Request Body
{
"name": "Jane Smith",
"email": "jane.smith@email.com",
"phone": "+34 600 987 654",
"establishmentId": "est_123456",
"dateOfBirth": "1990-05-15",
"address": {
"street": "Calle Mayor 45",
"city": "Barcelona",
"postalCode": "08001",
"country": "Spain"
}
}
Request Body Parameters
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | Player's full name |
string | Yes | Player's unique email | |
phone | string | Yes | Phone number |
establishmentId | string | Yes | ID of the establishment where they register |
dateOfBirth | string | No | Date of birth (YYYY-MM-DD) |
address | object | No | Player's address |
Responses
201 - Player Created Successfully
{
"id": "player_789012",
"name": "Jane Smith",
"email": "jane.smith@email.com",
"phone": "+34 600 987 654",
"status": "active",
"establishmentId": "est_123456",
"totalSpent": 0.00,
"currency": "EUR",
"createdAt": "2024-01-20T16:45:00Z",
"message": "Player created successfully"
}
400 - Invalid Data
{
"error": "VALIDATION_ERROR",
"message": "The provided data is not valid",
"details": [
{
"field": "email",
"message": "Email is already registered"
}
],
"code": 400
}
500 - Internal Server Error
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
GET /players/{playerId}
Gets detailed information about a specific player.
Endpoint
Description
Retrieves all information associated with a player, including their history and statistics.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
playerId | Unique player identifier | string | path | Yes |
Responses
200 - Player Found Successfully
{
"id": "player_345678",
"name": "John Doe",
"email": "john.doe@email.com",
"phone": "+34 600 123 456",
"status": "active",
"establishmentId": "est_123456",
"dateOfBirth": "1985-03-22",
"address": {
"street": "Calle Alcalá 123",
"city": "Madrid",
"postalCode": "28014",
"country": "Spain"
},
"statistics": {
"totalSpent": 2500.50,
"totalOrders": 15,
"averageOrderValue": 166.70,
"lastOrderDate": "2024-01-18T10:30:00Z"
},
"createdAt": "2024-01-10T09:15:00Z",
"lastActivity": "2024-01-20T14:30:00Z"
}
404 - Player Not Found
{
"error": "PLAYER_NOT_FOUND",
"message": "Player with ID player_345678 not found",
"code": 404
}
PUT /players/{playerId}
Updates information for an existing player.
Endpoint
Description
Allows you to modify data for a registered player.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
playerId | Unique player identifier | string | path | Yes |
Request Body
{
"name": "John Carlos Doe",
"phone": "+34 600 123 999",
"address": {
"street": "Calle Nueva 456",
"city": "Madrid",
"postalCode": "28015",
"country": "Spain"
}
}
Responses
200 - Player Updated Successfully
{
"id": "player_345678",
"name": "John Carlos Doe",
"email": "john.doe@email.com",
"phone": "+34 600 123 999",
"status": "active",
"establishmentId": "est_123456",
"updatedAt": "2024-01-20T17:00:00Z",
"message": "Player updated successfully"
}
404 - Player Not Found
{
"error": "PLAYER_NOT_FOUND",
"message": "Player with ID player_345678 not found",
"code": 404
}
DELETE /players/{playerId}
Deletes a player from the system.
Endpoint
Description
Permanently deletes a player and all associated data.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
playerId | Unique player identifier | string | path | Yes |
Responses
200 - Player Deleted Successfully
{
"message": "Player deleted successfully",
"deletedPlayerId": "player_345678",
"deletedAt": "2024-01-20T17:15:00Z"
}
404 - Player Not Found
{
"error": "PLAYER_NOT_FOUND",
"message": "Player with ID player_345678 not found",
"code": 404
}
Products
Products are items that players can purchase with their points or coins in establishments.
POST /exclusive
Creates an exclusive product for a specific establishment.
Endpoint
Description
Allows you to create exclusive products that will only be available in specific establishments.
Request Body
{
"name": "VIP Exclusive Product",
"description": "Special product only for VIP members",
"price": 500.00,
"currency": "EUR",
"establishmentId": "est_123456",
"category": "electronics",
"stock": 10,
"isDigital": false,
"imageUrl": "https://example.com/product-image.jpg"
}
Request Body Parameters
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | Product name |
description | string | Yes | Detailed product description |
price | number | Yes | Product price |
currency | string | Yes | Currency (EUR, USD, etc.) |
establishmentId | string | Yes | Exclusive establishment ID |
category | string | Yes | Product category |
stock | integer | No | Available quantity (default: 0) |
isDigital | boolean | No | If it's a digital product (default: false) |
imageUrl | string | No | Product image URL |
Responses
201 - Exclusive Product Created Successfully
{
"id": "prod_exclusive_001",
"name": "VIP Exclusive Product",
"description": "Special product only for VIP members",
"price": 500.00,
"currency": "EUR",
"establishmentId": "est_123456",
"category": "electronics",
"stock": 10,
"isDigital": false,
"imageUrl": "https://example.com/product-image.jpg",
"status": "active",
"createdAt": "2024-01-20T18:00:00Z",
"message": "Exclusive product created successfully"
}
400 - Invalid Data
{
"error": "VALIDATION_ERROR",
"message": "The provided data is not valid",
"details": [
{
"field": "price",
"message": "Price must be a positive number"
}
],
"code": 400
}
500 - Internal Server Error
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
GET /products
Gets a list of available products.
Endpoint
Description
Retrieves a paginated list of products with optional filters.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
establishment_id | Establishment ID to filter products | string | query | Yes |
page | Page number (default: 1) | integer | query | No |
limit | Items per page (default: 20) | integer | query | No |
category | Filter by category | string | query | No |
minPrice | Minimum price | number | query | No |
maxPrice | Maximum price | number | query | No |
status | Product status (active, inactive) | string | query | No |
Request Example
curl -X GET "https://stageapi.thepowerplugin.com//products?establishment_id=est_123456&page=1&limit=10&category=electronics" \
-H "Authorization: Bearer your_token_here"
Responses
200 - Products List Retrieved Successfully
{
"products": [
{
"id": "prod_789012",
"name": "iPhone 15 Pro",
"description": "Latest generation smartphone",
"price": 1199.99,
"currency": "EUR",
"category": "electronics",
"stock": 5,
"isDigital": false,
"imageUrl": "https://example.com/iphone15.jpg",
"status": "active",
"createdAt": "2024-01-15T10:00:00Z"
}
],
"pagination": {
"currentPage": 1,
"totalPages": 3,
"totalItems": 25,
"itemsPerPage": 10
}
}
400 - Invalid Parameters
{
"error": "INVALID_PARAMETERS",
"message": "establishment_id is required",
"code": 400
}
500 - Internal Server Error
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
POST /products
Creates a new product in the system.
Endpoint
Description
Registers a new product that will be available in establishments.
Request Body
{
"name": "Samsung Galaxy S24",
"description": "High-end Android smartphone",
"price": 999.99,
"currency": "EUR",
"category": "electronics",
"stock": 20,
"isDigital": false,
"imageUrl": "https://example.com/galaxy-s24.jpg",
"establishmentIds": ["est_123456", "est_789012"]
}
Request Body Parameters
Attribute | Type | Required | Description |
---|---|---|---|
name | string | Yes | Product name |
description | string | Yes | Product description |
price | number | Yes | Product price |
currency | string | Yes | Product currency |
category | string | Yes | Product category |
stock | integer | No | Stock quantity (default: 0) |
isDigital | boolean | No | If it's digital (default: false) |
imageUrl | string | No | Image URL |
establishmentIds | array | Yes | IDs of establishments where it will be available |
Responses
201 - Product Created Successfully
{
"id": "prod_galaxy_s24",
"name": "Samsung Galaxy S24",
"description": "High-end Android smartphone",
"price": 999.99,
"currency": "EUR",
"category": "electronics",
"stock": 20,
"isDigital": false,
"imageUrl": "https://example.com/galaxy-s24.jpg",
"establishmentIds": ["est_123456", "est_789012"],
"status": "active",
"createdAt": "2024-01-20T19:00:00Z",
"message": "Product created successfully"
}
400 - Invalid Data
{
"error": "VALIDATION_ERROR",
"message": "The provided data is not valid",
"details": [
{
"field": "price",
"message": "Price must be a positive number"
}
],
"code": 400
}
500 - Internal Server Error
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
GET /products/{productId}
Gets detailed information about a specific product.
Endpoint
Description
Retrieves all information associated with a product, including availability and details.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
productId | Unique product identifier | string | path | Yes |
Responses
200 - Product Found Successfully
{
"id": "prod_789012",
"name": "iPhone 15 Pro",
"description": "Latest generation smartphone with professional camera",
"price": 1199.99,
"currency": "EUR",
"category": "electronics",
"stock": 5,
"isDigital": false,
"imageUrl": "https://example.com/iphone15.jpg",
"status": "active",
"establishmentIds": ["est_123456", "est_789012"],
"specifications": {
"brand": "Apple",
"model": "iPhone 15 Pro",
"color": "Natural Titanium",
"storage": "256GB"
},
"createdAt": "2024-01-15T10:00:00Z",
"updatedAt": "2024-01-20T14:30:00Z"
}
404 - Product Not Found
{
"error": "PRODUCT_NOT_FOUND",
"message": "Product with ID prod_789012 not found",
"code": 404
}
PUT /products/{productId}
Updates information for an existing product.
Endpoint
Description
Allows you to modify data for a registered product.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
productId | Unique product identifier | string | path | Yes |
Request Body
{
"name": "iPhone 15 Pro Max",
"price": 1299.99,
"stock": 8,
"description": "Latest generation smartphone with larger screen"
}
Responses
200 - Product Updated Successfully
{
"id": "prod_789012",
"name": "iPhone 15 Pro Max",
"description": "Latest generation smartphone with larger screen",
"price": 1299.99,
"currency": "EUR",
"category": "electronics",
"stock": 8,
"isDigital": false,
"imageUrl": "https://example.com/iphone15.jpg",
"status": "active",
"updatedAt": "2024-01-20T20:00:00Z",
"message": "Product updated successfully"
}
404 - Product Not Found
{
"error": "PRODUCT_NOT_FOUND",
"message": "Product with ID prod_789012 not found",
"code": 404
}
500 - Internal Server Error
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}
DELETE /products/{productId}
Deletes a product from the system.
Endpoint
Description
Permanently deletes a product and all associated data.
Parameters
Attribute | Description | Type | Location | Required |
---|---|---|---|---|
productId | Unique product identifier | string | path | Yes |
Responses
200 - Product Deleted Successfully
{
"message": "Product deleted successfully",
"deletedProductId": "prod_789012",
"deletedAt": "2024-01-20T20:30:00Z"
}
404 - Product Not Found
{
"error": "PRODUCT_NOT_FOUND",
"message": "Product with ID prod_789012 not found",
"code": 404
}
500 - Internal Server Error
{
"error": "INTERNAL_SERVER_ERROR",
"message": "An internal error occurred. Please try again later.",
"code": 500
}