Starship Rewards API

Reference Data API

Access categories, subcategories, countries, and currencies for product filtering and localization

Reference Data API

The Reference Data API provides essential lookup data for categories, subcategories, countries, and currencies. This data is used for product filtering, localization, and building user interfaces.

Categories API

List Categories

Get all active categories with pagination.

GET /api/v1/categories
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Query Parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 25, max: 100)

Example Response:

[
  {
    "id": 1,
    "name": "Gift Cards"
  },
  {
    "id": 2,
    "name": "Mobile Top-up"
  },
  {
    "id": 3,
    "name": "Digital Services"
  }
]

Get Category by ID

Retrieve a specific category by its unique identifier.

GET /api/v1/categories/{id}
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Example Response:

{
  "id": 1,
  "name": "Gift Cards"
}

Subcategories API

List Subcategories

Get all active subcategories with pagination.

GET /api/v1/subcategories
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Query Parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 25, max: 100)

Example Response:

[
  {
    "id": 101,
    "name": "Retail Gift Cards"
  },
  {
    "id": 102,
    "name": "Entertainment Gift Cards"
  },
  {
    "id": 201,
    "name": "Prepaid Mobile Credit"
  }
]

Get Subcategory by ID

Retrieve a specific subcategory by its unique identifier.

GET /api/v1/subcategories/{id}
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Example Response:

{
  "id": 101,
  "name": "Retail Gift Cards"
}

Countries API

List Countries

Get all countries with pagination and filtering options.

GET /api/v1/countries
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Query Parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 25, max: 100)

Example Response:

[
  {
    "id": 1,
    "name": "United States",
    "alpha2": "US",
    "alpha3": "USA",
    "official_name": "United States of America",
    "numeric_code": "840",
    "dialing_prefix": "+1"
  },
  {
    "id": 2,
    "name": "United Kingdom",
    "alpha2": "GB",
    "alpha3": "GBR",
    "official_name": "United Kingdom of Great Britain and Northern Ireland",
    "numeric_code": "826",
    "dialing_prefix": "+44"
  }
]

Get Country by ID

Retrieve a specific country by its unique identifier.

GET /api/v1/countries/{id}
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Example Response:

{
  "id": 1,
  "name": "United States",
  "alpha2": "US",
  "alpha3": "USA",
  "official_name": "United States of America",
  "numeric_code": "840",
  "dialing_prefix": "+1"
}

Currencies API

List Currencies

Get all currencies with pagination support.

GET /api/v1/currencies
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Query Parameters:

ParameterTypeDescription
pageintegerPage number (default: 1)
per_pageintegerItems per page (default: 25, max: 100)

Example Response:

[
  {
    "id": 1,
    "country_id": 1,
    "name": "US Dollar",
    "currency": "USD",
    "symbol": "$",
    "currency_code": "USD",
    "precision": 2
  },
  {
    "id": 2,
    "country_id": 2,
    "name": "Pound Sterling",
    "currency": "GBP",
    "symbol": "£",
    "currency_code": "GBP",
    "precision": 2
  }
]

Get Currency by ID

Retrieve a specific currency by its unique identifier.

GET /api/v1/currencies/{id}
X-API-Key: sk_live_abc123def456
X-API-Secret: your-secret-here

Example Response:

{
  "id": 1,
  "country_id": 1,
  "name": "US Dollar",
  "currency": "USD",
  "symbol": "$",
  "currency_code": "USD",
  "precision": 2
}

Code Example

Here's a basic PHP implementation for the Reference Data API:

Response Fields

Category Fields

FieldTypeDescription
idintegerUnique category identifier
namestringDisplay name of the category

Subcategory Fields

FieldTypeDescription
idintegerUnique subcategory identifier
namestringDisplay name of the subcategory

Country Fields

FieldTypeDescription
idintegerUnique country identifier
namestringCommon country name
alpha2stringISO 3166-1 alpha-2 country code
alpha3stringISO 3166-1 alpha-3 country code
official_namestringOfficial country name
numeric_codestringISO 3166-1 numeric country code
dialing_prefixstringInternational dialing prefix

Currency Fields

FieldTypeDescription
idintegerUnique currency identifier
country_idintegerAssociated country ID
namestringFull currency name
currencystringCurrency abbreviation
symbolstringCurrency symbol
currency_codestringISO currency code
precisionintegerDecimal precision for amounts

Common Use Cases

Building Product Filters

Use categories and subcategories to create hierarchical product filters:

  1. Fetch all categories for top-level navigation

    GET /api/v1/categories?per_page=100
  2. Load subcategories for detailed filtering

    GET /api/v1/subcategories?per_page=100
  3. Use category/subcategory IDs in product search queries

    GET /api/v1/products?category_id=1&subcategory_id=101

Localization and Currency Display

Combine country and currency data for proper localization. Use the country_id on each currency to map a user's country to their preferred currency, then format prices using the currency's precision and symbol fields.

Error Responses

{
  "error": {
    "code": "NOT_FOUND",
    "message": "Category not found",
    "details": {}
  }
}

Best Practices

Caching Strategy

Reference data changes infrequently, making it ideal for caching:

  • Cache categories and subcategories for 24 hours
  • Cache countries indefinitely (they rarely change)
  • Cache currencies for 1 hour (exchange rates may affect display)

Pagination

Always handle pagination for large datasets:

  • Use reasonable per_page values (25-100)
  • Check X-Total-Pages header for complete data
  • Implement client-side pagination for better user experience

Data Validation

Validate reference data IDs before making API calls:

  • Ensure IDs are positive integers
  • Handle cases where referenced data might be inactive
  • Provide fallback options for missing reference data