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

List every auth scheme with its test credentials

GEThttps://api.testingapis.com/api/auth

Responses

200
Schemes, endpoints and credentials.

Example

Request
curl -X GET "https://api.testingapis.com/api/auth"
Run in Studio
Response200 OK
{
  "message": "Hardcoded credentials for every auth scheme. Send them wrong to test your 401 handling; the role endpoints also return 403.",
  "schemes": [
    {
      "scheme": "basic",
      "endpoint": "GET /api/auth/basic",
      "credentials": {"username": "apibee", "password": "password123"}
    },
    {
      "scheme": "basic (path creds)",
      "endpoint": "GET /api/auth/basic/{user}/{pass}",
      "credentials": "Any user/pass — must match the path"
    },
    "… 12 more items"
… (2 more lines)

Code examples

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

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

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