Download OpenAPI specification:Download
REST control plane for GripMock, a gRPC mock server.
Use it to load stubs, ask which stub a request would match, read call history and assert call counts — all while the server keeps running.
Base URL. Every path below is relative to /api, served on the HTTP port (4771 by
default). The gRPC port (4770) and the ConnectRPC/gRPC-web gateway (4769) are separate.
Sessions. Send X-Gripmock-Session: <id> to scope a request to one session. Stubs
created within a session are visible only there, and call history is kept apart. Without
the header the request works against the global scope. The header is the only thing that
decides scope here: a session field inside a posted stub is ignored, so no caller can
place stubs into someone else's session. Stub files loaded from disk keep their own
session field.
Not in this document. POST /api/mcp speaks the Model Context Protocol for agent
tooling, and GET /metrics — outside /api — serves Prometheus metrics.
Returns combined dashboard counters, runtime metadata, and process state in one response.
{- "appName": "string",
- "version": "string",
- "goVersion": "string",
- "compiler": "string",
- "goos": "string",
- "goarch": "string",
- "numCPU": 1,
- "startedAt": "2019-08-24T14:15:22Z",
- "uptimeSeconds": 0,
- "ready": true,
- "historyEnabled": true,
- "totalServices": 0,
- "totalStubs": 0,
- "usedStubs": 0,
- "unusedStubs": 0,
- "coveredMethods": 0,
- "totalMethods": 0,
- "grpcAddr": "string",
- "gatewayAddr": "string",
- "httpAddr": "string",
- "totalSessions": 0,
- "runtimeDescriptors": 0,
- "totalHistory": 0,
- "historyErrors": 0
}Returns lightweight aggregate counters for admin UI dashboard.
{- "totalServices": 0,
- "totalStubs": 0,
- "usedStubs": 0,
- "unusedStubs": 0,
- "coveredMethods": 0,
- "totalMethods": 0,
- "grpcAddr": "string",
- "gatewayAddr": "string",
- "httpAddr": "string",
- "totalSessions": 0,
- "runtimeDescriptors": 0,
- "totalHistory": 0,
- "historyErrors": 0
}Returns GripMock build metadata and current runtime process information.
{- "appName": "string",
- "version": "string",
- "goVersion": "string",
- "compiler": "string",
- "goos": "string",
- "goarch": "string",
- "numCPU": 1,
- "startedAt": "2019-08-24T14:15:22Z",
- "uptimeSeconds": 0,
- "ready": true,
- "historyEnabled": true,
- "totalServices": 0,
- "totalStubs": 0,
- "totalSessions": 0,
- "runtimeDescriptors": 0
}[- {
- "id": "string",
- "package": "string",
- "name": "string",
- "methods": [
- {
- "id": "string",
- "name": "string",
- "methodType": "unary",
- "requestType": "string",
- "responseType": "string",
- "requestSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "responseSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "clientStreaming": true,
- "serverStreaming": true
}
]
}
]List of registered service methods
| serviceID required | string ID of service |
[- {
- "id": "string",
- "name": "string",
- "methodType": "unary",
- "requestType": "string",
- "responseType": "string",
- "requestSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "responseSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "clientStreaming": true,
- "serverStreaming": true
}
]Returns exact metadata for one method (by short name or full method id).
| serviceID required | string Full service name (e.g. helloworld.Greeter) |
| methodID required | string Method short name (e.g. SayHello) or full id (e.g. helloworld.Greeter/SayHello) |
{- "id": "string",
- "name": "string",
- "methodType": "unary",
- "requestType": "string",
- "responseType": "string",
- "requestSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "responseSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "clientStreaming": true,
- "serverStreaming": true
}Returns exact metadata for one service including all methods and streaming capabilities.
| serviceID required | string Full service name (e.g. helloworld.Greeter) |
{- "id": "string",
- "package": "string",
- "name": "string",
- "methods": [
- {
- "id": "string",
- "name": "string",
- "methodType": "unary",
- "requestType": "string",
- "responseType": "string",
- "requestSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "responseSchema": {
- "typeName": "string",
- "recursiveRef": true,
- "fields": [
- {
- "name": "string",
- "jsonName": "string",
- "number": 1,
- "kind": "string",
- "cardinality": "optional",
- "typeName": "string",
- "oneof": "string",
- "enumValues": [
- "string"
], - "map": true,
- "mapKeyKind": "string",
- "mapValueKind": "string",
- "mapValueTypeName": "string",
- "message": { },
- "mapValueMessage": { }
}
]
}, - "clientStreaming": true,
- "serverStreaming": true
}
]
}Create, list, search and delete stubs, and inspect why one matched. Send X-Gripmock-Session: <id> to scope the call to one session; without it the request works against the global scope.
The list is needed to quickly find used stubs
[- {
- "id": "51c50050-ec27-4dae-a583-a32ca71a1dd5",
- "service": "Gripmock",
- "method": "SayHello",
- "priority": 0,
- "used": true,
- "session": "string",
- "headers": {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}, - "anyOf": [
- {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}
}
]
}, - "input": {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}, - "inputs": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}
], - "output": {
- "data": "string",
- "stream": null,
- "template": true,
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "trailers": {
- "property1": "string",
- "property2": "string"
}, - "error": "Message not found",
- "code": 3,
- "details": [
- {
- "type": "string"
}
], - "delay": "1s"
}, - "options": {
- "times": 0
}, - "effects": [
- {
- "action": "upsert",
- "id": "string",
- "stub": { }
}
], - "source": "string"
}
]The list is needed to quickly find unused stubs
[- {
- "id": "51c50050-ec27-4dae-a583-a32ca71a1dd5",
- "service": "Gripmock",
- "method": "SayHello",
- "priority": 0,
- "used": true,
- "session": "string",
- "headers": {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}, - "anyOf": [
- {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}
}
]
}, - "input": {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}, - "inputs": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}
], - "output": {
- "data": "string",
- "stream": null,
- "template": true,
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "trailers": {
- "property1": "string",
- "property2": "string"
}, - "error": "Message not found",
- "code": 3,
- "details": [
- {
- "type": "string"
}
], - "delay": "1s"
}, - "options": {
- "times": 0
}, - "effects": [
- {
- "action": "upsert",
- "id": "string",
- "stub": { }
}
], - "source": "string"
}
]The list of stubs is required to view all added stubs. Use source query param to filter by source.
| source | string Filter by source (file, rest, mcp, proxy) |
| service | string Filter by service name (exact match) |
| method | string Filter by method name (exact match) |
| session | string Filter by session ID (empty means global stubs) |
| q | string Case-insensitive substring search over service, method and stub ID |
| matcher | string Filter by matcher kind(s) present on the stub input. Comma-separated for OR semantics (e.g. "glob,anyOf"). Valid kinds: equals, contains, matches, glob, anyOf. |
| limit | integer >= 1 Maximum number of returned stubs |
| offset | integer >= 0 Number of stubs to skip before returning results |
| sort | string Sort order for result list |
[- {
- "id": "51c50050-ec27-4dae-a583-a32ca71a1dd5",
- "service": "Gripmock",
- "method": "SayHello",
- "priority": 0,
- "used": true,
- "session": "string",
- "headers": {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}, - "anyOf": [
- {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}
}
]
}, - "input": {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}, - "inputs": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}
], - "output": {
- "data": "string",
- "stream": null,
- "template": true,
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "trailers": {
- "property1": "string",
- "property2": "string"
}, - "error": "Message not found",
- "code": 3,
- "details": [
- {
- "type": "string"
}
], - "delay": "1s"
}, - "options": {
- "times": 0
}, - "effects": [
- {
- "action": "upsert",
- "id": "string",
- "stub": { }
}
], - "source": "string"
}
]Creates a new stub or multiple stubs and adds them to the storage
Create a new stub in the store
| id | string <uuid> (ID) Stub identifier (UUID). |
| service required | string Fully qualified gRPC service name. |
| method required | string gRPC method name, without the service prefix. |
| priority | integer Default: 0 Tie-breaker among equally specific stubs; higher wins. Specificity is compared first, so an |
| used | boolean Response-only — whether the stub has matched at least once. Ignored on input. |
object (StubHeaders) Matchers applied to gRPC request metadata. Header names are case-insensitive. All blocks present are AND-ed; an omitted or empty block always passes. | |
required | object (StubInput) Matchers applied to the request body. All blocks present are AND-ed; an omitted or empty block always passes, so a stub with every block empty matches any request. |
Array of objects (StubInput) Per-message matchers for client and bidirectional streaming. With one element it is a broadcast pattern that every message must match; with several, element N is matched against the Nth message and the counts must be equal. Mutually exclusive with | |
required | object (StubOutput) What the stub returns. Over this API exactly one side must be set: either the unary side ( |
object (StubOptions) Optional behavior settings for a stub | |
Array of objects (StubEffect) Side effects applied after successful stub match |
[ ][ ]Takes IDs as input and deletes them
Delete stubs by their IDs
Stub identifier (UUID).
[- "51c50050-ec27-4dae-a583-a32ca71a1dd5"
]Validates one or more stubs and returns them normalized without adding to storage
Stub payload to validate
| id | string <uuid> (ID) Stub identifier (UUID). |
| service required | string Fully qualified gRPC service name. |
| method required | string gRPC method name, without the service prefix. |
| priority | integer Default: 0 Tie-breaker among equally specific stubs; higher wins. Specificity is compared first, so an |
| used | boolean Response-only — whether the stub has matched at least once. Ignored on input. |
object (StubHeaders) Matchers applied to gRPC request metadata. Header names are case-insensitive. All blocks present are AND-ed; an omitted or empty block always passes. | |
required | object (StubInput) Matchers applied to the request body. All blocks present are AND-ed; an omitted or empty block always passes, so a stub with every block empty matches any request. |
Array of objects (StubInput) Per-message matchers for client and bidirectional streaming. With one element it is a broadcast pattern that every message must match; with several, element N is matched against the Nth message and the counts must be equal. Mutually exclusive with | |
required | object (StubOutput) What the stub returns. Over this API exactly one side must be set: either the unary side ( |
object (StubOptions) Optional behavior settings for a stub | |
Array of objects (StubEffect) Side effects applied after successful stub match |
[ ][ ]Searches for Stub by ID
| uuid required | string <uuid> (ID) Example: 51c50050-ec27-4dae-a583-a32ca71a1dd5 ID of stub |
{- "id": "51c50050-ec27-4dae-a583-a32ca71a1dd5",
- "service": "Gripmock",
- "method": "SayHello",
- "priority": 0,
- "used": true,
- "session": "string",
- "headers": {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}, - "anyOf": [
- {
- "equals": {
- "property1": "string",
- "property2": "string"
}, - "contains": {
- "property1": "string",
- "property2": "string"
}, - "matches": {
- "property1": "string",
- "property2": "string"
}, - "glob": {
- "property1": "string",
- "property2": "string"
}
}
]
}, - "input": {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}, - "inputs": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { },
- "anyOf": [
- {
- "ignoreArrayOrder": false,
- "equals": { },
- "contains": { },
- "matches": { },
- "glob": { }
}
]
}
], - "output": {
- "data": "string",
- "stream": null,
- "template": true,
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "trailers": {
- "property1": "string",
- "property2": "string"
}, - "error": "Message not found",
- "code": 3,
- "details": [
- {
- "type": "string"
}
], - "delay": "1s"
}, - "options": {
- "times": 0
}, - "effects": [
- {
- "action": "upsert",
- "id": "string",
- "stub": { }
}
], - "source": "string"
}Performs a search for a stub by the given conditions
Search criteria including service, method, headers and data to match against stubs
| id | string <uuid> (ID) Stub identifier (UUID). |
| service required | string Fully qualified gRPC service name. |
| method required | string gRPC method name. |
object Request metadata to match against stub | |
required | object Request body to match against stub |
{- "id": "51c50050-ec27-4dae-a583-a32ca71a1dd5",
- "service": "Gripmock",
- "method": "SayHello",
- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": { }
}{- "headers": {
- "property1": "string",
- "property2": "string"
}, - "data": { },
- "error": "Message not found",
- "code": 3
}Returns detailed matching stages/candidates for a query without consuming stub times.
Inspect criteria including service, method, optional headers/session and input messages
| id | string <uuid> (ID) Stub identifier (UUID). |
| service required | string Fully qualified gRPC service name. |
| method required | string gRPC method name. |
| session | string Session to resolve against; empty means the global scope. |
object Request metadata, matched against stub | |
Array of objects Request body, matched against stub |
{- "id": "51c50050-ec27-4dae-a583-a32ca71a1dd5",
- "service": "string",
- "method": "string",
- "session": "string",
- "headers": { },
- "input": [
- { }
]
}{- "service": "string",
- "method": "string",
- "session": "string",
- "matchedStubId": "string",
- "similarStubId": "string",
- "fallbackToMethod": true,
- "error": "string",
- "stages": [
- {
- "name": "string",
- "before": 0,
- "after": 0,
- "removed": 0
}
], - "candidates": [
- {
- "id": "string",
- "service": "string",
- "method": "string",
- "session": "string",
- "priority": 0,
- "times": 0,
- "used": 0,
- "specificity": 0,
- "score": 0.1,
- "visibleBySession": true,
- "withinTimes": true,
- "headersMatched": true,
- "inputMatched": true,
- "matched": true,
- "excludedBy": [
- "string"
], - "events": [
- {
- "stage": "string",
- "result": "string",
- "reason": "string"
}
]
}
]
}Calls the server has answered, newest first. Send X-Gripmock-Session: <id> to scope the call to one session; without it the request works against the global scope.
Returns recorded gRPC calls (when history is enabled)
| limit | integer >= 0 Return at most N most-recent records |
| offset | integer >= 0 Skip the N newest records (page backward through older calls) |
| service | string Keep only calls to this fully qualified service name. |
| method | string Keep only calls to this method name. |
| error | boolean When true, return only calls that ended with a gRPC error |
[- {
- "service": "string",
- "method": "string",
- "session": "string",
- "stubId": "7f68f1f7-7a51-47df-892c-d9d4ce205592",
- "timestamp": "2019-08-24T14:15:22Z",
- "requests": [
- { }
], - "responses": [
- null
], - "responseHeaders": {
- "property1": "string",
- "property2": "string"
}, - "code": 0,
- "error": "string",
- "elapsedMs": 0
}
]Deletes recorded calls. With X-Gripmock-Session only the records of that session are removed, so a test can reset its own history without disturbing the calls of a parallel session; without the header the whole history is cleared.
{- "deletedCount": 0,
- "session": "string"
}Assert how many times a method was called. Send X-Gripmock-Session: <id> to scope the call to one session; without it the request works against the global scope.
Asserts that a method was called a specified number of times. With X-Gripmock-Session the count covers that session's calls plus global ones — the same scope its stubs match in. Without the header every call is counted, including calls made under a session.
| service required | string Fully qualified gRPC service name. |
| method required | string gRPC method name. |
| expectedCount required | integer >= 0 Number of calls the method must have received. |
{- "service": "string",
- "method": "string",
- "expectedCount": 0
}{- "message": "string",
- "time": "2019-08-24T14:15:22Z"
}Accepts binary Protocol Buffers FileDescriptorSet. Registers descriptors for dynamic service discovery. Returns service IDs for later removal via DELETE /services/{serviceID}.
{- "message": "string",
- "time": "2019-08-24T14:15:22Z",
- "serviceIDs": [
- "string"
]
}