# API Reference

Developers can use the M² REST API to interact programmatically with M² resources and services using HTTP requests.

With the API, developers can create game content and mods, list user / server data, manage pixel streaming sessions, retrieve information about their organization and projects.

M² REST API supports any programming language or framework that can send HTTP requests. Our API reference shows examples written using `Python`, `cURL` and `JavaScript`.

## Basics

### Spec

Our API is exposed as an HTTP/2-3 endpoint over TLS. All endpoints live under a dedicated customer URL (`https://{organization-id}.m2worlds.io`) and follow REST practices.

### Rate Limits

We limit the number of calls you can make over a certain period of time. When the rate limit is exceeded, an error is returned with the status `429 Too Many Requests`. Calling applications will need to handle the 429 status code and use exponential backoff or some other retry logic to decrease the rate of calls to your API.

## Endpoints

### [Accounts](https://docs.msquared.io/apis-and-tooling/api-reference/accounts)

The Accounts service allows you to manage user accounts registered within your organization, including creation, updates, and access control.

### [Key/Value Store](https://docs.msquared.io/apis-and-tooling/api-reference/kvstore)

This service provides a flexible, runtime-accessible key/value store for persisting arbitrary data. It can be used by both game clients and servers to cache, retrieve, and manage state and user data.

### [Organizations](https://docs.msquared.io/apis-and-tooling/api-reference/organizations)

Manage your organization's configuration, including associated resources such as Projects. This service helps structure how different teams and services operate within your SaaS environment.

### [Realtime](https://docs.msquared.io/apis-and-tooling/api-reference/realtime)

Provides real-time updates from the Key/Value Store via WebSockets. Ideal for live data synchronization between game clients and backend services.

### [User Profile](https://docs.msquared.io/apis-and-tooling/api-reference/profile)

DEPRECATED. Previously used to manage player profile data. This service is being phased out in favor of the more flexible Key/Value Store.

### [World Builder](https://docs.msquared.io/apis-and-tooling/api-reference/world-builder)

Controls the creation and management of World Builder content and mods. It interfaces with the Unreal Engine editor to customize cooking, packaging, and deployment for both game clients and servers.

### [Worlds](https://docs.msquared.io/apis-and-tooling/api-reference/worlds)

The Worlds service manages virtual environments, each defined by World Builder content with custom runtime settings (map selection, session duration, etc.).
