Interactions API Authentication
How to authenticate requests to the Interactions API
Authentication
The Interactions API uses HTTP Basic Authentication to secure all endpoints.
How to Authenticate
- Obtain your API key from MIG as explained here. Treat these credentials as sensitive information. Do not share or expose them in public repositories or client-side code.
- Include an Authorization header in every request to the Interactions API:
Authorization: Basic <credentials>Where
<credentials>is your organization name and API key joined by a colon ([your_org]:[your_api_key]), then Base64-encoded.
Example
If your org name is is my_org and your password is bVAynbc234qafdsg2345sdfrfF, encode my_org:bVAynbc234qafdsg2345sdfrfF in Base64 to get bXlfb3JnOmJWQXluYmMyMzRxYWZkc2cyMzQ1c2RmcmZG. Use that value in your Authorization header.
Authorization: Basic bXlfb3JnOmJWQXluYmMyMzRxYWZkc2cyMzQ1c2RmcmZGTesting your API Key
The /auth/me endpoint allows you to verify that your API key credentials are valid and active. Use this endpoint to test or validate your API credentials before making other requests. No request body is required.
More documentation on this endpoint is available here.
Example
- Send a GET request to /auth/me with your Basic Authentication header.
GET /auth/me HTTP/1.1
Host: api.movementinfrastructure.org/v1
Authorization: Basic <Base64-encoded-credentials>https://api.movementinfrastructure.org/v1/auth/me -H "Authorization: Basic <Base64-encoded-credentials>"- Check the response:
- A 200 OK response confirms your credentials are valid.
- A 401 Unauthorized response means your credentials are invalid.
- A 403 Forbidden response means your request did not contain an
Authorizationheader.
Notes
- All API requests must use HTTPS to protect credentials and data in transit.
- All API requests must include the Authorization header.
- If authentication fails, the API will return a 401 Unauthorized response. If the
Authorizationheader is not present, the API will return a 403 Forbidden response. - Never share your credentials.
- For more details, see the HTTP Basic Authentication specification.
Updated 11 days ago