Performing POST / PUT / DELETE requests
How to perform POST / PUT / DELETE requests using the web scraping API
Use the same HTTP method on https://api.scrapingant.com/v2/general that you want to send to the target. Supply your x-api-key and URL-encoded target url as query parameters; put the target's data in the request body.
The method and body are forwarded to the target web page. Replace the API key placeholder with your key from your profile.
Use custom headers to set the target's Content-Type: ScrapingAnt removes the Ant- prefix before forwarding the header. This form example sends a message field to HTTPBin's echo endpoint:
curl -X "POST" "https://api.scrapingant.com/v2/general?url=https:%2F%2Fhttpbin.org%2Fanything&x-api-key=<YOUR_SCRAPINGANT_API_KEY>" \
-H 'Ant-Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'message=Hello from ScrapingAnt'
For a PUT request, change POST to PUT and supply the body the target expects. For DELETE, change it to DELETE and omit the body unless the target requires one. For a JSON body, use Ant-Content-Type: application/json and send valid JSON with --data-binary.
The general endpoint returns the target page content using the same response format as GET. With the default browser rendering, a JSON echo page can be returned inside HTML; use JSON response if you need the structured response envelope. Check Ant-page-status-code for the target's HTTP status: a successful ScrapingAnt response does not by itself mean the target accepted your operation.
For an API error, inspect the JSON detail string and the error reference. HTTP 403 can mean an invalid API key or exhausted credits; HTTP 422 indicates a missing or invalid parameter.