> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.megamation.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.megamation.com/_mcp/server.

# Overview

There are multiple methods available for authenticating requests used in the API. Details of the most commonly used methods are detailed here. If you're developing your own front end, we will need to enable Cross Origin Resource Sharing (CORS) for your site ([https://en.wikipedia.org/wiki/Cross-origin_resource_sharing](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)).

**Basic Authentication with IP Security**

This method involves including a provided username and password encrypted in the header of each call made to the API. Using a program such as Postman and adding the credentials on the authorization tab will automatically encrypt and add the information to the header as a valid Authorization.

Manually adding this to the header requires you adding an 'Authorization' header field with the information provided as 'Basic Username:password' with the user and password being Base64 encoded.

An example of what an authorization in the request header for basic authentication would look like:

'Basic c3VIOnBhc3M='

This authentication is encrypted again over a secure socket layer (SSL/HTTPS) and has IP security placed on top of it. This allows only validated requests to go through to the API if it also comes from a list of provided and validated IP addresses. This list would be created by you and Megamation.

**Bearer Token using JSON Web Token (JWT)** `Version 1.02`

This method involves getting an encrypted Bearer Token using our login API and providing the Bearer Token in each API call rather than the username and password as done so with Basic Authentication.

Bearer Tokens carry an expiry and can be used for multiple requests until that expiry. After that it is required to get a new Token. The default expiry is 1 day after issue. You can use the Refresher Token to obtain a new Token and new Refresher Token. Refresher Token also has a default expiry date of 30 days.

To Obtain a bearer token using the API you send a JSON body including a username, password, and client ID and will get back the signed Token. The Token contains encrypted information including who logged in, the expiry and issue time, and a hashed signature. The API compares this against our internal hash information to verify each call when using the token.

When using Bearer tokens you have the option of adding IP Security as is done for Basic authentication but, unlike Basic authentication, is not required.

An example of what an authorization in the request header when using a bearer token would look like:

'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL3d3dy5tZWdhbWF0aW9uLmNvbS8iLCJleHAiOjE2MI6MTYyOTg5OTkxMCwic3ViIjoiQlJBRCJ9.25NszwIOWFrO-eXvUK5amDsazicCchB9_m0wAeo0Y2o'