Authentication
Learn how to authenticate your API requests to MyDisct Solver. All API requests require a valid API key for authentication and authorization.
API Key
Your API key is a unique identifier that authenticates your requests to the MyDisct Solver API. You can find your API key in your dashboard after signing up.
Sign up for a free account to get your API key and start solving captchas.
Authentication Methods
MyDisct Solver API supports two authentication methods. You can use either method based on your preference:
Method 1: Header Authentication (Recommended)
Include your API key in the apikey header of your HTTP request:
POST /createTask HTTP/1.1
Host: solver-api.mydisct.com
Content-Type: application/json
apikey: YOUR_API_KEY
{
"auth": {
"token": "YOUR_API_KEY"
},
...
}
Method 2: Body Authentication
Include your API key in the request body under auth.token:
{
"auth": {
"token": "YOUR_API_KEY"
},
"context": {
"source": "api",
"version": "1.0.0"
},
"captcha": {
...
}
}
Code Examples
JavaScript (Fetch API)
const API_KEY = 'YOUR_API_KEY';
const response = await fetch('https://solver-api.mydisct.com/createTask', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'apikey': API_KEY
},
body: JSON.stringify({
auth: {
token: API_KEY
},
context: {
source: 'api',
version: '1.0.0'
},
captcha: {
}
})
});
const data = await response.json();
console.log(data);
Python (Requests)
import requests
API_KEY = 'YOUR_API_KEY'
response = requests.post(
'https://solver-api.mydisct.com/createTask',
headers={
'Content-Type': 'application/json',
'apikey': API_KEY
},
json={
'auth': {
'token': API_KEY
},
'context': {
'source': 'api',
'version': '1.0.0'
},
'captcha': {
# Your captcha data here
}
}
)
data = response.json()
print(data)
cURL
curl -X POST https://solver-api.mydisct.com/createTask \
-H "Content-Type: application/json" \
-H "apikey: YOUR_API_KEY" \
-d '{
"auth": {
"token": "YOUR_API_KEY"
},
"context": {
"source": "api",
"version": "1.0.0"
},
"captcha": {
...
}
}'
Best Practices
- Never expose your API key in client-side code (JavaScript in browsers)
- Don't commit API keys to version control systems (Git, SVN, etc.)
- Use environment variables to store your API key
- Rotate your API key regularly from your dashboard
- Use different API keys for development and production
- Monitor your API usage for suspicious activity
Environment Variables Example
# .env file
MYDISCT_API_KEY=your_api_key_here
// Load from environment variable
const API_KEY = process.env.MYDISCT_API_KEY;
const response = await fetch('https://solver-api.mydisct.com/createTask', {
headers: {
'apikey': API_KEY
},
});
Rate Limiting
API requests are rate-limited at two levels to ensure fair usage and system stability:
| Layer | Scope | Default Limit | Window |
|---|---|---|---|
| IP-Based | Per IP address (all endpoints) | 1,000 requests | 1 minute |
| API Key-Based | Per API key (authenticated endpoints) | 1,000 requests (customizable per user/package) | 1 minute |
Each authenticated API response includes rate limit information in the headers:
X-RateLimit-Limit: Your maximum requests per minute (RPM)X-RateLimit-Remaining: Requests remaining in current windowX-RateLimit-Reset: Seconds until the rate limit window resets
Common Issues
Error Code: INVALID_API_KEY
Solution: Double check that you have copied the API key correctly from the dashboard. Ensure there are no extra spaces.
Error Code: INSUFFICIENT_BALANCE
Solution: Your account balance is too low to process the request. Please top up your balance in the dashboard.
Error Code: RATE_LIMIT_EXCEEDED
Solution: You are sending too many requests. Implement a retry mechanism with exponential backoff or reduce your request rate.