Overview
The Musique Partner API uses token-based authentication. All requests must include anX-API-Key header with a valid API token.
Generate Token
Create a new API authentication token for Partner API access.Endpoint
Request Body
Your internal identifier for this integration (e.g., “loja1”, “store_001”)
Company token provided by Musique during onboarding
Request Example
Response
Your API authentication token. Store this securely.
Token expiration timestamp.
null means the token doesn’t expire.Test Token
Verify that your API token is valid and has the required permissions.Endpoint
Headers
Your API authentication token
Request Example
Response
Whether the token is valid
The external ID associated with this token
The Musique user ID mapped to your external ID
List of permissions granted to this token
Revoke Token
Invalidate an API token immediately. Use this if a token is compromised or no longer needed.Endpoint
Headers
The API token to revoke
Request Example
Response
Confirmation that the token was revoked
Success message
After revoking a token, you’ll need to generate a new one to continue using the API. Update your applications with the new token.
Token Security Best Practices
Store Securely
Store Securely
DO:
- Use environment variables (
process.env.MUSIQUE_API_KEY) - Store in secret management systems (AWS Secrets Manager, HashiCorp Vault)
- Encrypt tokens at rest in databases
- Hardcode in source code
- Commit to version control (check
.gitignore) - Expose in client-side JavaScript
- Share via unsecure channels (email, chat)
Rotate Regularly
Rotate Regularly
- Generate new tokens periodically (e.g., every 90 days)
- Revoke old tokens after migrating to new ones
- Maintain audit logs of token generation/revocation
- Have a process for emergency token rotation
Monitor Usage
Monitor Usage
- Track which tokens are making requests
- Set up alerts for unusual activity patterns
- Review API logs regularly
- Use different tokens for different environments (dev, staging, production)
Limit Scope
Limit Scope
- Use separate tokens for different integrations
- Request minimum necessary permissions
- Implement the principle of least privilege
- Revoke unused tokens immediately
Common Issues
Token Not Working
Token Not Working
Possible causes:
- Token was revoked
- Incorrect header name (must be
X-API-Key) - Token has whitespace or line breaks
- Token is for wrong environment
/api/integration/test endpoint and verify the response.Cannot Generate Token
Cannot Generate Token
Possible causes:
- Invalid company token
- External ID already in use
- Account not set up for Partner API access
Insufficient Permissions
Insufficient Permissions
Possible causes:
- Token doesn’t have required permissions
- Account limitations
- Feature not enabled for your plan
/api/integration/test and contact support to adjust.
