New in 2.4: Test runs you can trust See what's new →

Accepts only POST and echoes the body

POSThttps://api.testingapis.com/api/methods/post

Up to 1MB of body is echoed; larger bodies are counted and flagged with bodyTruncated.

Request body

Optional. application/json. Optional body; described in the response.

Example body
{"a": 1}

Responses

200
Method, query, content type and body.
405
Any other verb.

Example

Request
curl -X POST "https://api.testingapis.com/api/methods/post" \
  -H "Content-Type: application/json" \
  -d '{"a": 1}'
Run in Studio
Response200 OK
{
  "method": "POST",
  "message": "POST request received",
  "path": "/api/methods/post",
  "query": {},
  "contentType": "application/json",
  "bodyLength": 8,
  "bodyTruncated": false,
  "body": "{\"a\": 1}",
  "timestamp": "2026-09-30T18:26:44Z"
}

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/methods/post", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: "{\"a\": 1}",
});
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "POST",
    "https://api.testingapis.com/api/methods/post",
    headers={
        "Content-Type": "application/json",
    },
    data="{\"a\": 1}".encode("utf-8"),
    allow_redirects=False,
)
print(response.status_code, response.text)
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.NEVER)
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.testingapis.com/api/methods/post"))
            .header("Content-Type", "application/json")
            .method("POST", HttpRequest.BodyPublishers.ofString("{\"a\": 1}"))
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}