Replace Music Section Callbacks
Understand the callback mechanism for replace music section tasksWhen you submit a replace music section task to the API, you can provide a
callBackUrl to receive real-time notifications about task progress and completion.
Callback Mechanism
When Callbacks Are Sent
The system sends callbacks at the following times:- Complete: When the replacement task is fully completed
Callback Method
- HTTP Method: POST
- Content-Type: application/json
- Timeout: 10 seconds
- Retry Policy: Up to 3 attempts with exponential backoff
Request Format
Success Callback
When the replacement task completes successfully:Failure Callback
When the replacement task fails:Status Codes
Response Fields
Success Response Fields
Status code indicating the result of the replacement task
Status message describing the result
Container for callback data
Implementation Examples
Node.js (Express)
Python (Flask)
PHP
Callback Security
Verification Recommendations
- IP Whitelist: Restrict callback endpoints to known IP addresses
- HTTPS Only: Always use HTTPS for callback URLs in production
- Request Validation: Validate the structure and content of callback requests
- Timeout Handling: Implement proper timeout handling for callback processing
Example Security Implementation
Troubleshooting
Common Issues
Q: Callbacks are not being received- Verify your callback URL is publicly accessible
- Check that your server is responding within 10 seconds
- Ensure your endpoint accepts POST requests with JSON content
- This can happen due to network issues or timeouts
- Implement idempotency using the task_id to handle duplicates
- Check the
callbackTypefield to understand the callback stage - For error callbacks, check the error message for details
- Always return a 200 status code to acknowledge receipt
- Use the Get Music Details endpoint to poll task status as a fallback
Best Practices
- Always Acknowledge: Return HTTP 200 even if your processing fails
- Implement Retry Logic: Handle temporary failures gracefully
- Log Everything: Keep detailed logs for debugging
- Use Fallback Polling: Don’t rely solely on callbacks for critical workflows
- Validate Data: Always validate callback data before processing
To find navigation and other pages in this documentation, fetch the llms.txt file at: https://docs.apikley.ru/llms.txt
Rate limits and quotas are enforced by Apikley and may differ from upstream providers.