Skip to content

bolasse1234/g2g-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

g2g-api

Lightweight, zero-dependency Node.js API for querying seller offers and pricing data from G2G.com.

What it does

  • Queries G2G's public-facing search endpoints (the same ones their frontend uses)
  • Returns individual seller offers with prices, stock, ratings, and delivery times
  • Resolves any G2G category slug to structured data
  • Accepts full G2G product URLs and extracts all filters automatically
  • Resolves human-readable product names (e.g. "Claude Max") to the correct filter
  • Returns clean, normalized JSON

What it does NOT do

  • It does not use G2G's official OpenAPI (which requires seller approval)
  • It does not buy, sell, or modify anything
  • It does not require authentication or API keys
  • It does not bypass any login or authentication walls

Quick start

# Requires Node.js 20+
node src/server.js

The server starts on http://127.0.0.1:3000.

API endpoints

GET /health

Health check.

GET /api/offers?url=<encoded-g2g-url>

Fetch seller offers by passing a full G2G product page URL.

# Example: Get all Claude Max offers
curl "http://localhost:3000/api/offers?url=https%3A%2F%2Fwww.g2g.com%2Fcategories%2Fclaude-accounts%2Foffer%2Fgroup%3Ffa%3Dd769c0bd%3A05c8eb3c&currency=USD&country=US"

The API extracts the category slug, filter attributes, region, and other params from the URL automatically.

GET /api/offers/:slug

Fetch offers by category slug with optional filters.

Param Description Default
selection Human-readable product name (e.g. Claude Max) -
filter_attr Raw G2G filter attribute (e.g. d769c0bd:05c8eb3c) -
country Country code US
currency Currency code USD
sort Sort order G2G default
page Page number 1
page_size Results per page (max 100) 20
region_id G2G region UUID -
group 0 for individual seller offers 0
# Get Claude Max offers sorted by price
curl "http://localhost:3000/api/offers/claude-accounts?selection=Claude+Max&currency=USD&sort=lowest_price"

GET /api/categories/:slug

Resolve a category slug to its service/brand IDs.

curl "http://localhost:3000/api/categories/claude-accounts"

GET /api/categories/:slug/collections

List all product variants (collections) for a category. Useful for finding valid selection or filter_attr values.

curl "http://localhost:3000/api/categories/claude-accounts/collections"

Response shape

{
  "category": {
    "slug": "claude-accounts",
    "serviceId": "f6a1aba5-...",
    "brandId": "c02e28f8-..."
  },
  "selection": {
    "label": "Claude Max Subscription 1 Month - Private Account (Global)",
    "path": "Claude Max > Claude Max Subscription 1 Month - Private Account (Global)"
  },
  "query": { "country": "US", "currency": "USD", "group": "0" },
  "totals": { "totalResult": 12, "maxTotalResult": 12 },
  "offers": [
    {
      "offerId": "G1772975394665RA",
      "title": "Claude Max Subscription 1 Month - Private Account (Global)",
      "seller": {
        "id": "1001452075",
        "username": "nipakunn",
        "ranking": 6,
        "satisfactionRate": 98.5,
        "totalSuccessOrder": 1200
      },
      "price": {
        "displayAmount": 80.0,
        "unitAmount": 90,
        "currency": "USD"
      },
      "stock": { "availableQuantity": 100 },
      "delivery": { "fastestMinutes": 240 }
    }
  ]
}

Running tests

npm test

Tests hit G2G's live endpoints, so they require an internet connection.

Deployment

Zero dependencies. Just copy the files and run with Node.js 20+.

# Run directly
node src/server.js

# Or with a custom port
PORT=8080 node src/server.js

For production use, run behind a process manager:

# With systemd, pm2, or similar
pm2 start src/server.js --name g2g-api

Disclaimer

This project is an independent, unofficial, third-party tool. It is not affiliated with, endorsed by, or associated with G2G.com or any of its parent companies in any way.

This software queries publicly accessible endpoints that G2G's own frontend uses. It does not circumvent any authentication, access controls, or technical protection measures.

Use at your own risk. The authors assume no responsibility for how this software is used. Users are solely responsible for ensuring their use complies with G2G's Terms of Service and all applicable laws.

G2G may change their endpoints at any time, which could break this tool without notice.

License

MIT

About

Lightweight third-party API for querying G2G.com seller offers and pricing data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors