---
title: "create expectations from a GraphQL schema"
method: PUT
path: "/mockserver/graphql"
tags: ["expectation"]
---

# create expectations from a GraphQL schema

`PUT /mockserver/graphql`

## Request

- Base URL: `http://localhost:1080`
- URL: `http://localhost:1080/mockserver/graphql`
- Auth: none declared

Generates expectations from a GraphQL schema (the request body is a GraphQL SDL document or an introspection JSON result) and adds them. One expectation is created per root operation type (query / mutation / subscription); each matches any operation of that kind and synthesizes a schema-valid response per request. The optional "path" query parameter overrides the default "/graphql" request path the generated expectations match.

## Query parameters

- `path` string

## Response `201`

expectations created from the GraphQL schema

- Expectation[]: list of upserted expectations (unresolved $ref)

## Other responses

- `400`: invalid or unparseable GraphQL schema

---

[API](https://skmtc.dev/mock-server/apis/mockserver-api.md) · [All operations](https://skmtc.dev/mock-server/apis/mockserver-api/llms.txt) · [OpenAPI document](https://skmtc.dev/mock-server/apis/mockserver-api/revisions/9239b693996e?raw)
