Skip to content

A fast and simple Xbox Live API, built on Cloudflare Workers.

License

Notifications You must be signed in to change notification settings

MrMicky-FR/XboxAPI-Workers

Repository files navigation

XboxAPI Workers

Node.js CI

A fast and simple Xbox Live API, built on Cloudflare Workers.

This project uses two Cloudflare Workers KV namespaces:

  • (Required) TOKEN_STORE: Used to store Xbox access tokens
  • (Optional) PROFILES_CACHE: Used to cache Xbox profiles to reduce responses time (profiles are cached for one hour)

Features

  • Fast: Running on more than 300 datacenters worldwide thanks to the power of Cloudflare Workers
  • Easy to use: A profile can be fetched with a single GET request

Installation

  • Install Wrangler CLI
  • Install dependencies with npm install
  • Copy wrangler.example.toml to wrangler.toml
  • Create a KV namespace named TOKENS_STORE and add its id in the wrangler.toml
  • (Optional) Create a KV namespace named PROFILES_CACHE and add its id in the wrangler.toml
  • Configure the XBOX_ACCESS_TOKEN and XBOX_REFRESH_TOKEN variables in the wrangler.toml with your Xbox Live tokens (see below to obtain them)
  • Deploy to Workers with workers deploy

Get your Xbox Live tokens

  • Go on this link in your browser, authenticate and once you reach a blank page, copy the URL
  • Extract the access_token and refresh_token parameters from the copied URL (you can also use this tiny tool)

Endpoints

Fetch a profile by XUID

GET /profiles/{xuid}

Example profile:

{
  "xuid": "2533275056522057",
  "gamerscore": "28337",
  "gamertag": "Hello",
  "gamerpic": "https://images-eds-ssl.xboxlive.com/image?url=wHwbXKif8cus8csoZ03RW8ke8ralOdP9BGd4wzwl0MJ9z6QzuGwZjtvbE7sSsMVWdbcqfkxoWP60BSmwjdrqjdnbtjpTZg2sgv2Zu6A4iNhBj4V1ePvsMGSKEhUsgp5yZqOg.wtIFgQcnAf.8lY8BoeFGho.yDFWyybpENa_9L0-",
  "reputation": "GoodPlayer",
  "tier": "Gold",
  "bio": "",
  "location": "Hello from the otherside!"
}

Fetch a profile by Gamertag

GET /profiles/search/{gamertag}

Example profile:

{
  "xuid": "2533275056522057",
  "gamerscore": "28337",
  "gamertag": "Hello",
  "gamerpic": "https://images-eds-ssl.xboxlive.com/image?url=wHwbXKif8cus8csoZ03RW8ke8ralOdP9BGd4wzwl0MJ9z6QzuGwZjtvbE7sSsMVWdbcqfkxoWP60BSmwjdrqjdnbtjpTZg2sgv2Zu6A4iNhBj4V1ePvsMGSKEhUsgp5yZqOg.wtIFgQcnAf.8lY8BoeFGho.yDFWyybpENa_9L0-",
  "reputation": "GoodPlayer",
  "tier": "Gold",
  "bio": "",
  "location": "Hello from the otherside!"
}

About

A fast and simple Xbox Live API, built on Cloudflare Workers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published