API Documentation

Comprehensive guide to using ZeinCard API Gateway

Introduction

Welcome to the ZeinCard API Gateway documentation! This gateway provides a unified API for accessing various ZeinCard services, including categories, products, orders, and profile management.

This gateway is designed to simplify the integration process with the ZeinCard system and provide a seamless experience for developers.

Key Features

Secure Authentication

All requests secured with dedicated API keys

JSON Format

All requests and responses in easy-to-use JSON format

RESTful Interface

Simple and efficient API design

Authentication

All endpoints in the ZeinCard API Gateway use an API key for authentication. The API key must be included in the header of each request.

Authentication Header

x-api-key: YOUR_API_KEY

Note: To obtain an API key, please contact the support team.

Endpoints

Here is a list of all available endpoints in the ZeinCard API Gateway.

Categories

GET /api/v1/categories

Get a list of all main categories.

Response

{
  "success": true,
  "data": [
    {
      "id": "1",
      "name": "Games",
      "description": "Electronic game cards and currencies",
      "image": "https://example.com/images/games.png"
    },
    // ...
  ]
}
GET /api/v1/categories/:categoryId

Get details of a specific category by ID.

Parameters

Parameter Type Description
categoryId string Category ID
GET /api/v1/categories/subcategories

Get a list of all subcategories.

GET /api/v1/categories/subcategories/:subcategoryId

Get details of a specific subcategory by ID.

Parameters

Parameter Type Description
subcategoryId string Subcategory ID
GET /api/v1/categories/:categoryId/subcategories

Get a list of subcategories belonging to a specific category.

Parameters

Parameter Type Description
categoryId string Main category ID

Products

GET /api/v1/products

Get a list of all products.

GET /api/v1/products/available

Get a list of available products.

GET /api/v1/products/subcategory/:subcategoryId

Get a list of products belonging to a specific subcategory.

Parameters

Parameter Type Description
subcategoryId string Subcategory ID
GET /api/v1/products/search

Search for products based on specific criteria.

Query Parameters

Parameter Type Description
q string Search text
category string Category ID (optional)
subcategory string Subcategory ID (optional)
GET /api/v1/products/:id

Get details of a specific product by ID.

Parameters

Parameter Type Description
id string Product ID

Orders

POST /api/v1/orders

Create a new order.

Request Body

{
  "user_id": "123",
  "product_id": "456",
  "quantity": 1,
  "player_id": "player123",
  "player_name": "PlayerName"
}

Response

{
  "success": true,
  "data": {
    "orderId": "789",
    "orderDetails": {
      "userEmail": "user@example.com",
      "username": "username",
      "totalAmount": "10.99",
      "currencyCode": "USD",
      "status": "pending",
      "createdAt": "2025-07-11T00:42:10.281Z",
      "items": [
        {
          "productId": "456",
          "productName": "Product Name",
          "playerId": "player123",
          "playerName": "PlayerName",
          "quantity": 1,
          "totalPrice": "10.99"
        }
      ]
    },
    "productInfo": {
      "id": "456",
      "name": "Product Name",
      "description": "Product Description",
      "price": 10.99,
      "currency": "USD"
    }
  }
}
GET /api/v1/orders

Get a list of user orders.

Query Parameters

Parameter Type Description
status string Filter by status (optional)
GET /api/v1/orders/:id

Get details of a specific order by ID.

Parameters

Parameter Type Description
id string Order ID

Profile

GET /api/v1/profile

Get current user information.

Response

{
  "success": true,
  "data": {
    "id": "123",
    "email": "user@example.com",
    "username": "username",
    "name": "User Name",
    "phone": "+1234567890",
    "createdAt": "2025-01-01T00:00:00.000Z",
    "isActive": true,
    "preferences": {}
  }
}

Examples

Example: Create a New Order

Here's an example of how to create a new order using cURL:

curl -X POST "https://api.zeincard.com/api/v1/orders" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "123",
    "product_id": "456",
    "quantity": 1,
    "player_id": "player123",
    "player_name": "PlayerName"
  }'

Example: Get Available Products

Here's an example of how to get a list of available products:

curl "https://api.zeincard.com/api/v1/products/available" \
  -H "x-api-key: YOUR_API_KEY"

Errors

In case of an error, a JSON response containing error information will be returned.

{
  "success": false,
  "message": "Error message",
  "details": {
    // Additional error details (optional)
  }
}

Common HTTP Status Codes

Code Description
200 Success
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error