Skip to content
Last updated

Getting started

This guide walks you through making your first request to the M2X Public API.

Prerequisites

  • An M2X account with API access enabled.
  • A client ID and client secret, provided by M2X.
  • A tool for making HTTP requests (curl, Postman, or your language's HTTP client).

The steps below are an example flow using curl. You can also send requests interactively from the browser — see Using "Try it".

1. Set your base URL

All requests are made against the M2X Public API base URL. Replace the placeholder below with the environment you're targeting.

export M2X_BASE_URL="https://m2x.app"
Environments

Confirm the correct base URLs for your sandbox and production environments with your M2X account manager before going live.

2. Request an access token

Exchange your client ID and secret for an access token using the OAuth 2.0 client credentials flow. See Authentication for the full details, including how to choose scopes.

export M2X_CLIENT_ID="your-client-id"
export M2X_CLIENT_SECRET="your-client-secret"

curl -X POST "$M2X_BASE_URL/openId/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=$M2X_CLIENT_ID" \
  -d "client_secret=$M2X_CLIENT_SECRET" \
  -d "scope=read:bookings"

3. Make your first request

Use the access_token from the previous response as a bearer token:

export M2X_TOKEN="<your-access-token>"

curl "$M2X_BASE_URL/apis/v0/products" \
  -H "Authorization: Bearer $M2X_TOKEN" \
  -H "Accept: application/json"

A successful response returns a 200 OK with a JSON payload.

4. Next steps