Authentication
To access the Selling.com API, you need to authenticate your requests using an API key. This API key acts as a unique identifier for your account and ensures that only authorized users can access the API's resources.
Generating Your API Key
    To get started with the API, follow these steps to generate your API key:
  • Log in to Your Account: Visit app.selling.com and log in using your credentials.
  • Navigate to the API Section. Once logged in, go to your API page, "API Keys" section.
  • Generate a New API Key. Click on the option to generate a new API key. You may be prompted to name the key or provide a description for easier management.
  • Copy the API Key. Once the key is generated, you will be shown the key on your screen. Copy this key and store it securely, as it will not be shown again. Treat your API key like a password - keep it safe and do not share it publicly.
Using Your API Key in Requests
Once you have your API key, you will need to include it in the header of every API request. This ensures that your request is authenticated and can be processed by our servers.
Authorization Header Format
To authenticate your API requests, include the API key in the Authorization header of your HTTP requests using the following format: Authorization: Bearer YOUR_API_KEY
Example of what a complete request might look like (cURL):
curl -X POST "https://api.selling.com/contact" \
-H "Authorization: Bearer your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
    "email": "example@domain.com",
    "first_name": "John",
    "last_name": "Doe",
}'
Securing Your API Key
    Your API key grants access to your account's data, so it’s important to keep it secure. Here are some best practices:
  • Do Not Share Your API Key: Keep your API key confidential. Never share it in public repositories, forums, or with unauthorized users.
  • Regenerate Compromised Keys: If you believe your API key has been compromised, immediately regenerate a new key from your account dashboard and update your applications to use the new key.
  • Use Environment Variables: When working with code, store your API key in environment variables instead of hardcoding it directly into your application code.
Managing API Keys
    You can manage your API keys directly from your account dashboard:
  • View Active Keys: See all API keys associated with your account.
  • Regenerate Keys: If you need additional API keys, you can generate a new one.
  • Revoke Keys: If an API key is no longer needed or has been compromised, you can revoke it to prevent further use.
Error Handling
    If your request is missing an API key or the key is invalid, the API will return a 401 Unauthorized error. Make sure to check the following:
  • Ensure that the Authorization header is included in your request.
  • Verify that the API key is correct and has not been revoked.
  • Double-check the header format to ensure there are no typos.
Example of a 401 Unauthorized Response
{
    "status": 401,
    "error": "Unauthorized",
    "message": "The API key you are using is invalid."
}