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

List posts with filtering, sorting, search and pagination

GEThttps://api.testingapis.com/api/Posts

Common filters: userId. Any other property name also works as an exact, case-insensitive filter. Paging and sorting: limit (1-100), page (1-based, needs limit), offset, sort (property name), order (asc or desc) and q (search across title, name, body, description and text fields). Totals are returned in the X-Total-Count, X-Page, X-Per-Page and X-Total-Pages headers.

Responses

200
The matching posts.
500
Unexpected server error.

Example

Request
curl -X GET "https://api.testingapis.com/api/Posts?limit=2"
Run in Studio
Response200 OK
X-Total-Count: 18
X-Page: 1
X-Per-Page: 2
X-Total-Pages: 9

[
  {
    "id": 1,
    "userId": 101,
    "title": "Getting Started with REST APIs",
    "body": "REST APIs are the backbone of modern web applications. In this post, we'll cover the basics of HTTP methods, status codes, and request/re…
    "tags": ["api", "tutorial", "beginner"],
    "publishedAt": "2025-07-01T14:00:00Z",
    "likes": 42
  },
  {
    "id: 2,
… (3 more lines)

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/Posts?limit=2");
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/Posts?limit=2",
    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/Posts?limit=2"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

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