{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-apis/publicapi/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Getting started","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"getting-started","__idx":0},"children":["Getting started"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide walks you through making your first request to the M2X Public API."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["An M2X account with API access enabled."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["client ID"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["client secret"]},", provided by M2X."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A tool for making HTTP requests (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]},", Postman, or your language's HTTP client)."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The steps below are an example flow using ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]},". You can also send requests interactively from the browser — see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/apis/publicapi/guides/try-it"},"children":["Using \"Try it\""]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-set-your-base-url","__idx":2},"children":["1. Set your base URL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All requests are made against the M2X Public API base URL. Replace the placeholder below with the environment you're targeting."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export M2X_BASE_URL=\"https://m2x.app\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Environments"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Confirm the correct base URLs for your sandbox and production environments with your M2X account manager before going live."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-request-an-access-token","__idx":3},"children":["2. Request an access token"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Exchange your client ID and secret for an access token using the OAuth 2.0 client credentials flow. See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/apis/publicapi/guides/authentication"},"children":["Authentication"]}," for the full details, including how to choose scopes."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export M2X_CLIENT_ID=\"your-client-id\"\nexport M2X_CLIENT_SECRET=\"your-client-secret\"\n\ncurl -X POST \"$M2X_BASE_URL/openId/token\" \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" \\\n  -d \"grant_type=client_credentials\" \\\n  -d \"client_id=$M2X_CLIENT_ID\" \\\n  -d \"client_secret=$M2X_CLIENT_SECRET\" \\\n  -d \"scope=read:bookings\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-make-your-first-request","__idx":4},"children":["3. Make your first request"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["access_token"]}," from the previous response as a bearer token:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"export M2X_TOKEN=\"<your-access-token>\"\n\ncurl \"$M2X_BASE_URL/apis/v0/products\" \\\n  -H \"Authorization: Bearer $M2X_TOKEN\" \\\n  -H \"Accept: application/json\"\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A successful response returns a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200 OK"]}," with a JSON payload."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"4-next-steps","__idx":5},"children":["4. Next steps"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Review ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/apis/publicapi/guides/authentication"},"children":["Authentication"]}," to manage credentials securely."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Browse the full ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/apis/publicapi/openapi"},"children":["API reference"]}," for every available endpoint."]}]}]},"headings":[{"value":"Getting started","id":"getting-started","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"1. Set your base URL","id":"1-set-your-base-url","depth":2},{"value":"2. Request an access token","id":"2-request-an-access-token","depth":2},{"value":"3. Make your first request","id":"3-make-your-first-request","depth":2},{"value":"4. Next steps","id":"4-next-steps","depth":2}],"frontmatter":{"seo":{"title":"Getting started"}},"lastModified":"2026-06-10T00:28:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/apis/publicapi/guides/getting-started","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}