Skip to content

⚠️ WORK IN PROGRESS

This wiki is under active development. Information may be incomplete or inaccurate.

Public Exchange API ​

Base URL: https://api.g2.galactictycoons.com

For more accurate and updated API information, visit API Swagger.

Get Single Material Price ​

GET /public/exchange/mat-prices/{materialId}

Returns price for a specific material.

Parameters:

  • materialId - Material ID

Response:

json
{
  "matId": 35,
  "matName": "Steel",
  "currentPrice": 47500,
  "avgPrice": 45200
}

Fields:

  • matId - Material ID
  • matName - Material name
  • currentPrice - Lowest price currently available in cents (-1 if no orders)
  • avgPrice - Average price from recent trades in cents (-1 if no history)

Get All Materials Prices ​

GET /public/exchange/mat-prices

Returns current prices for all tradeable materials.

Response:

json
{
  "prices": [
    {
      "matId": 1,
      "matName": "Iron Ore",
      "currentPrice": 4500,
      "avgPrice": -1
    },
    {
      "matId": 12,
      "matName": "Rations",
      "currentPrice": 4400,
      "avgPrice": 2700
    }
  ]
}

Fields:

  • matId - Material ID
  • matName - Material name
  • currentPrice - Lowest price currently available in cents (-1 if no orders)
  • avgPrice - Average price from recent trades in cents (-1 if no history)


Get Material Market Details ​

GET /public/exchange/mat-details/{materialId}

Returns detailed market information including orders, history, and statistics.

Parameters:

  • materialId - Material ID

Response:

json
{
  "matId": 35,
  "matName": "Steel",
  "currentPrice": 47500,
  "avgPrice": 45200,
  "totalQtyAvailable": 50000,
  "orders": [
    { "cId": 123, "cName": "Company A", "unitPrice": 47500, "qty": 1000 }
  ],
  "avgQtySoldDaily": 1250.5,
  "priceHistory": [
    { "date": "2025-10-10", "avgPrice": 47500, "qtySold": 1200, "qtyRemaining": 50000, "qtyC": 0 }
  ]
}

Fields:

  • matId - Material ID
  • matName - Material name
  • currentPrice - Lowest price currently available in cents (-1 if no orders)
  • avgPrice - Average price from recent trades in cents (-1 if no history)
  • totalQtyAvailable - Total quantity for sale (excludes Federal Reserve)
  • orders - Active sell offers sorted by price, cheapest first (includes Federal Reserve)
    • id - Order ID (unique identifier)
    • cId - Company ID (1 = Federal Reserve)
    • cName - Company name
    • unitPrice - Price per unit in cents
    • qty - Quantity available
  • avgQtySoldDaily - Average quantity sold per day (excluding Fed purchases from players)
  • priceHistory - Last 30 days (index 0 = today)
    • date - Date in YYYY-MM-DD format
    • avgPrice - Average trade price for the day in cents
    • qtySold - Quantity sold this day (excludes Federal Reserve purchases from players)
    • qtyRemaining - Quantity remaining at end of day, current quantity for today (excludes Federal Reserve)
    • qtyC - Quantity traded via contracts on this day

Get All Materials Market Details ​

GET /public/exchange/mat-details

Returns detailed market information for all tradeable materials including orders, history (last 7 days), and statistics.

Response:

json
{
  "materials": [ /* array of material details */ ]
}

Fields:

  • materials - Array of material details (same structure as single material details endpoint, but with 7 days of history)

Get Material Market History ​

GET /public/exchange/mat-history/{materialId}

Returns the full daily exchange history for the last 60 days: the same price history as the market details endpoint, plus how much of the material changed hands and for how much, how much of that was between players or bought from the Federal Reserve, and contract trades.

Parameters:

  • materialId - Material ID

Response:

json
{
  "matId": 35,
  "matName": "Steel",
  "days": [
    { "date": "2025-10-10", "avgPrice": 51500, "qtySold": 4500, "qtyRemaining": 3500, "qtyTot": 5000, "valueTot": 250000000, "qtyPlayers": 3000, "valuePlayers": 150000000, "qtyFromFed": 1500, "qtyC": 100, "valueC": 5000000 }
  ]
}

Fields:

  • matId - Material ID
  • matName - Material name
  • days - Last 60 days (index 0 = today, which is still accumulating)
    • date - Date in YYYY-MM-DD format
    • avgPrice - Average trade price for the day in cents (excludes contracts)
    • qtySold - Quantity sold this day (excludes Federal Reserve purchases from players)
    • qtyRemaining - Quantity remaining at end of day, current quantity for today (excludes Federal Reserve)
    • qtyTot - Total quantity traded on the exchange this day (players plus both Federal Reserve directions; excludes contracts)
    • valueTot - Total value traded on the exchange this day in cents (excludes contracts)
    • qtyPlayers / valuePlayers - Traded between players
    • qtyFromFed - Quantity players bought from the Federal Reserve
    • qtyC - Quantity traded via contracts this day
    • valueC - Value traded via contracts this day in cents (what buyers paid, including fees)

A company buying its own exchange order is not counted as a trade.


Rate Limiting ​

100 cost units per 5 minutes per IP address

EndpointCost
GET /public/exchange/mat-prices/{materialId}2
GET /public/exchange/mat-prices5
GET /public/exchange/mat-details/{materialId}5
GET /public/exchange/mat-details60
GET /public/exchange/mat-history/{materialId}5

Error Responses ​

CodeDescriptionBody
400Bad Request{ "error": "Invalid material ID" }
429Rate limit exceededNone
503Service UnavailableNone
500Internal Server ErrorNone

Notes ​

  • All prices are in cents (e.g., 4500 = 45.00$)
  • No authentication required