TestingAPIs is still being built. If something breaks, email support@testingapis.com.

GraphQL API

Send POST https://api.testingapis.com/graphqla POST request to the GraphQL endpoint with Content-Type: application/json and a body of { query, variables }. Opening /graphqlthe endpoint in a browser shows a GraphQL IDE. Schema introspection is turned off in production, so use the operations listed here. Each one has a Try it button that loads it into the playground.

POSThttps://api.testingapis.com/graphqlSign in to see the GraphQL URL
Request
curl -X POST "https://api.testingapis.com/graphql" \
  -H "Content-Type: application/json" \
  -d '{"query":"{ books(genre: \"programming\") { id title author } }"}'

Queries

users

Returns [User!]!.

Query
query { users { id name job city } }
Response
{
  "data": {
    "users": [
      {"id": 101, "name": "Hiroshi Tanaka", "job": "Engineer", "city": "Tokyo"},
      {"id": 102, "name": "Maria Gonzales", "job": "Doctor", "city": "Madrid"},
      "… 2 more items"
    ]
  }
}

user

Returns User. Arguments: id (Int!).

Query
query { user(id: 1) { id name job city } }
Response
{"data": {"user": null}}

products

Returns [Product!]!. Arguments: category (String).

Query
query { products(category: "electronics") { id title price description category } }
Response
{
  "data": {
    "products": [
      {
        "id": 1,
        "title": "Wireless Noise-Cancelling Headphones",
        "price": 249.99,
        "description": "Over-ear headphones with 30hr battery life and active noise cancellation.",
        "category": "electronics"
      },
      {
        "id": 2,
        "title": "Smartwatch Series 6",
        "price": 199.99,
        "description": "Fitness tracking, heart-rate monitor, and always-on OLED display.",
        "category": "electronics"
      },
      "… 6 more items"
… (3 more lines)

product

Returns Product. Arguments: id (Int!).

Query
query { product(id: 1) { id title price description category } }
Response
{
  "data": {
    "product": {
      "id": 1,
      "title": "Wireless Noise-Cancelling Headphones",
      "price": 249.99,
      "description": "Over-ear headphones with 30hr battery life and active noise cancellation.",
      "category": "electronics"
    }
  }
}

posts

Returns [Post!]!. Arguments: userId (Int).

Query
query { posts(userId: 101) { id userId title body tags } }
Response
{
  "data": {
    "posts": [
      {
        "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 reques…
        "tags": ["api", "tutorial", "beginner"]
      },
      {
        "id": 4,
        "userId": 101,
        "title": "10 Git Commands Every Developer Should Know",
        "body": "Beyond commit and push, these ten Git commands will make you faster and more confident, from reflog to interactive rebase.",
        "tags": ["git", "productivity", "tools"]
      },
      "… 3 more items
… (3 more lines)

post

Returns Post. Arguments: id (Int!).

Query
query { post(id: 1) { id userId title body tags } }
Response
{
  "data": {
    "post": {
      "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/…
      "tags": ["api", "tutorial", "beginner]
    }
  }
}

todos

Returns [Todo!]!. Arguments: completed (Boolean).

Query
query { todos(completed: true) { id userId title completed priority } }
Response
{
  "data": {
    "todos": [
      {
        "id": 3,
        "userId": 102,
        "title": "Prepare sprint demo",
        "completed": true,
        "priority": "high"
      },
      {
        "id": 6,
        "userId": 103,
        "title": "Set up CI/CD pipeline",
        "completed": true,
        "priority": "medium"
      },
      "… 9 more items"
… (3 more lines)

employees

Returns [Employee!]!. Arguments: department (String).

Query
query { employees(department: "Executive") { id firstName lastName email phone } }
Response
{
  "data": {
    "employees": [
      {
        "id": 1,
        "firstName": "Olivia",
        "lastName": "Bennett",
        "email": "olivia.bennett@nimbuscloud.example.com",
        "phone": "+1-555-101-1037"
      },
      {
        "id": 7,
        "firstName": "Sophia",
        "lastName": "Hughes",
        "email": "sophia.hughes@greenleaffoods.example.com",
        "phone": "+1-555-107-1259"
      },
      "… 6 more items"
… (3 more lines)

employee

Returns Employee. Arguments: id (Int!).

Query
query { employee(id: 1) { id firstName lastName email phone } }
Response
{
  "data": {
    "employee": {
      "id": 1,
      "firstName": "Olivia",
      "lastName": "Bennett",
      "email": "olivia.bennett@nimbuscloud.example.com",
      "phone": "+1-555-101-1037"
    }
  }
}

companies

Returns [Company!]!.

Query
query { companies { id name industry founded website } }
Response
{
  "data": {
    "companies": [
      {
        "id": 1,
        "name": "Nimbus Cloud Systems",
        "industry": "Technology",
        "founded": 2008,
        "website": "https://nimbuscloud.example.com"
      },
      {
        "id": 2,
        "name": "Greenleaf Foods",
        "industry": "Food & Beverage",
        "founded": 1994,
        "website": "https://greenleaffoods.example.com"
      },
      "… 8 more items"
… (3 more lines)

books

Returns [Book!]!. Arguments: genre (String).

Query
query { books(genre: "Drama") { id title author isbn genre } }
Response
{"data": {"books": []}}

book

Returns Book. Arguments: id (Int!).

Query
query { book(id: 1) { id title author isbn genre } }
Response
{
  "data": {
    "book": {
      "id": 1,
      "title": "Clean Code",
      "author": "Robert C. Martin",
      "isbn": "9780132350884",
      "genre": "programming"
    }
  }
}

movies

Returns [Movie!]!. Arguments: genre (String).

Query
query { movies(genre: "Drama") { id title director year genres } }
Response
{
  "data": {
    "movies": [
      {
        "id": 1,
        "title": "The Shawshank Redemption",
        "director": "Frank Darabont",
        "year": 1994,
        "genres": ["Drama"]
      },
      {
        "id": 2,
        "title": "The Godfather",
        "director": "Francis Ford Coppola",
        "year": 1972,
        "genres": ["Crime", "Drama"]
      },
      "… 14 more items"
… (3 more lines)

movie

Returns Movie. Arguments: id (Int!).

Query
query { movie(id: 1) { id title director year genres } }
Response
{
  "data": {
    "movie": {
      "id": 1,
      "title": "The Shawshank Redemption",
      "director": "Frank Darabont",
      "year": 1994,
      "genres": ["Drama"]
    }
  }
}

countries

Returns [Country!]!. Arguments: region (String).

Query
query { countries(region: "Americas") { id name code code3 capital } }
Response
{
  "data": {
    "countries": [
      {
        "id": 1,
        "name": "United States",
        "code": "US",
        "code3": "USA",
        "capital": "Washington, D.C."
      },
      {"id": 2, "name": "Canada", "code": "CA", "code3": "CAN", "capital": "Ottawa"},
      "… 6 more items"
    ]
  }
}

country

Returns Country. Arguments: code (String!).

Query
query { country(code: "IN") { id name code code3 capital } }
Response
{
  "data": {"country": {"id": 16, "name": "India", "code": "IN", "code3": "IND", "capital": "New Delhi"}}
}

people

Returns [Person!]!.

Query
query { people { id firstName lastName username email } }
Response
{
  "data": {
    "people": [
      {
        "id": 1,
        "firstName": "Aisha",
        "lastName": "Khan",
        "username": "akhan",
        "email": "akhan@example.com"
      },
      {
        "id": 2,
        "firstName": "Carlos",
        "lastName": "Mendes",
        "username": "cmendes",
        "email": "cmendes@example.com"
      },
      "… 20 more items"
… (3 more lines)

events

Returns [Event!]!. Arguments: category (String).

Query
query { events(category: "electronics") { id name category venue city } }
Response
{"data": {"events": []}}

albums

Returns [Album!]!. Arguments: userId (Int).

Query
query { albums(userId: 101) { id userId title } }
Response
{
  "data": {
    "albums": [
      {"id": 1, "userId": 101, "title": "Summer in Lisbon"},
      {"id": 2, "userId": 101, "title": "Office Dogs"},
      "… 2 more items"
    ]
  }
}

photos

Returns [Photo!]!. Arguments: albumId (Int).

Query
query { photos(albumId: 1) { id albumId title url thumbnailUrl } }
Response
{
  "data": {
    "photos": [
      {
        "id": 1,
        "albumId": 1,
        "title": "Summer in Lisbon - sunrise #1",
        "url": "https://picsum.photos/seed/photo1/600/600",
        "thumbnailUrl": "https://picsum.photos/seed/photo1/150/150"
      },
      {
        "id": 2,
        "albumId": 1,
        "title": "Summer in Lisbon - close-up #2",
        "url": "https://picsum.photos/seed/photo2/600/600",
        "thumbnailUrl": "https://picsum.photos/seed/photo2/150/150"
      },
      "… 5 more items"
… (3 more lines)

Mutations

createUser

Returns User!. Arguments: name (String!), job (String!), city (String!).

Mutation
mutation { createUser(name: "Asha", job: "Engineer", city: "Pune") { id name job city } }
Response
{"data": {"createUser": {"id": 7970, "name": "Asha", "job": "Engineer", "city": "Pune"}}}

updateUser

Returns User. Arguments: id (Int!), name (String!), job (String!), city (String!).

Mutation
mutation { updateUser(id: 1, name: "Asha", job: "Engineer", city: "Pune") { id name job city } }
Response
{"data": {"updateUser": null}}

deleteUser

Returns String!. Arguments: id (Int!).

Mutation
mutation { deleteUser(id: 1) }
Response
{"data": {"deleteUser": "User 1 not found"}}

addTodo

Returns Todo!. Arguments: title (String!), userId (Int!), priority (String!).

Mutation
mutation { addTodo(title: "Write docs", userId: 101, priority: "high") { id userId title completed priority } }
Response
{
  "data": {
    "addTodo": {"id": 35, "userId": 101, "title": "Write docs", "completed": false, "priority": "high"}
  }
}

toggleTodo

Returns Todo. Arguments: id (Int!).

Mutation
mutation { toggleTodo(id: 30) { id userId title completed priority } }
Response
{
  "data": {
    "toggleTodo": {
      "id": 30,
      "userId": 110,
      "title": "Schedule stakeholder review",
      "completed": false,
      "priority": "low"
    }
  }
}

deleteTodo

Returns Boolean!. Arguments: id (Int!).

Mutation
mutation { deleteTodo(id: 30) }
Response
{"data": {"deleteTodo": true}}

Types

TypeFields
Photoid: Int!, albumId: Int!, title: String!, url: String!, thumbnailUrl: String!
CompanyHeadquarterscity: String!, country: String!
Postid: Int!, userId: Int!, title: String!, body: String!, tags: [String!]!, publishedAt: String!, likes: Int!
GeoLocationlat: Float!, lng: Float!
Bookid: Int!, title: String!, author: String!, isbn: String!, genre: String!, publishedYear: Int!, pages: Int!, language: String!, price: Decimal!, rating: Float!, available: Boolean!, tags: [String!]!
CountryCurrencycode: String!, name: String!, symbol: String!
Personid: Int!, firstName: String!, lastName: String!, username: String!, email: String!, gender: String!, dateOfBirth: String!, phone: String!, avatar: String!, address: Address!, company: PersonCompany!
PersonCompanyname: String!, title: String!
Albumid: Int!, userId: Int!, title: String!
Movieid: Int!, title: String!, director: String!, year: Int!, genres: [String!]!, runtimeMinutes: Int!, rating: Float!, cast: [String!]!, boxOffice: Long!, poster: String!
Todoid: Int!, userId: Int!, title: String!, completed: Boolean!, priority: String!, dueDate: String!
Companyid: Int!, name: String!, industry: String!, founded: Int!, website: String!, headquarters: CompanyHeadquarters!, revenue: Decimal!, employeeCount: Int!
Productid: Int!, title: String!, price: Decimal!, description: String!, category: String!, image: String!, rating: Rating!, inStock: Boolean!, createdAt: String!
Addressstreet: String!, city: String!, state: String!, zip: String!, country: String!, geo: GeoLocation
Userid: Int!, name: String!, job: String!, city: String!
Countryid: Int!, name: String!, code: String!, code3: String!, capital: String!, region: String!, population: Long!, area: Float!, currency: CountryCurrency!, languages: [String!]!, callingCode: String!, flag: String!, timezones: [String!]!
Ratingrate: Float!, count: Int!
Employeeid: Int!, firstName: String!, lastName: String!, email: String!, phone: String!, department: String!, title: String!, salary: Decimal!, hireDate: String!, managerId: Int, companyId: Int!, skills: [String!]!, address: Address!, active: Boolean!
Eventid: Int!, name: String!, category: String!, venue: String!, city: String!, startsAt: String!, endsAt: String!, price: Decimal!, capacity: Int!, ticketsSold: Int!, organizer: String!, tags: [String!]!

Sign in to see the details

The parameters, request and response examples and the live Try it panel for the GraphQL API are for signed-in members. Accounts are free and take a few seconds to create.