Authentication
Marsol API uses token-based authentication to ensure secure access to its endpoints. To authenticate requests, an x-auth-token must be included in the headers of each API call. This token verifies that the request is coming from an authorized user and allows access to the desired resource.
Obtaining an API Token
To obtain an x-auth-token, follow these steps:
Register: Sign up for an account on the Marsol platform.
Create Project: Navigate to the Projects page, select one of your projects.
Generate Token: Navigate to the
Tokensettings section in your project and generate a new token.Store Securely: Keep your API token secure and do not share it publicly. This token is your key to accessing Marsol's services.
Using the API Token
Include the x-auth-token in the headers of your API requests. Below is an example of how to include the token in a request:
GET /public/virtual-numbers HTTP/1.1
Host: api.marsol.ly
x-auth-token: your_api_token_here
Content-Type: application/jsonToken Activity
API tokens must be enabled (active) and do not exceed the usage limit to access Marsol's endpoints. Make sure to check the state of your token and generate a new token or adjust its quota when needed. You can generate a token through the Token settings in your Marsol projects.
Error Handling
If the provided token is invalid or has insufficient quota, the API will return an authentication error with the appropriate HTTP status code:
401 Unauthorized: The request lacks valid authentication credentials.
Best Practices
Use HTTPS: Always use HTTPS to encrypt your API requests and protect your token.
Limit Token Scope: Generate tokens with the minimum required scope for your application to minimize security risks.
Monitor Usage: Regularly monitor your token usage and revoke any tokens that are no longer needed.
By following these guidelines, you can ensure secure and reliable access to the Marsol API.
Last updated