---
title: "Create a custom resolver"
method: POST
path: "/groups/{groupId}/apps/{appId}/graphql/custom_resolvers"
tags: ["graphql"]
---

# Create a custom resolver

`POST /groups/{groupId}/apps/{appId}/graphql/custom_resolvers`

Create a new [custom resolver](https://www.mongodb.com/docs/atlas/app-services/graphql/custom-resolvers/).

## Request body

- CustomResolver
  - `on_type` string, required — The name of the resolver's parent type. This can be `"Query"`, `"Mutation"`, or the name of a generated type if this is a computed property.
  - `field_name` string, required — The name of the custom resolver field that appears in the GraphQL schema.
  - `input_type` union — The type of the custom resolver's `input` parameter. This can be a scalar, the name of an existing generated type, or a custom JSON schema object. If undefined, the resolver does not accept an input.
    - string
    - object
  - `input_type_format` 'scalar' | 'scalar-list' | 'generated' | 'generated-list' | 'custom' — The kind of input type the custom resolver uses. This value must agree with the value of `input_type`: - A scalar input type must use `"scalar"` or `"scalar-list"` - A generated input type must use `"generated"` or `"generated-list"` - A custom input type must use `"custom"` If undefined, the resolver does not accept an input.
  - `payload_type` union — The type of the value returned by the custom resolver. This can be a scalar, the name of an existing generated type, or a custom JSON schema object. If undefined, the resolver returns a `DefaultPayload` object: ```graphql type DefaultPayload { status: String! } ```
    - string
    - object
  - `payload_type_format` 'scalar' | 'scalar-list' | 'generated' | 'generated-list' | 'custom' — The kind of payload type the custom resolver uses. This value must agree with the value of `payload_type`: - A scalar payload type must use `"scalar"` or `"scalar-list"` - A generated payload type must use `"generated"` or `"generated-list"` - A custom payload type must use `"custom"` If undefined, the resolver returns a `DefaultPayload` object.
  - `_id` string, required — The custom resolver's unique ID.
  - `function_id` string, required — The resolver function's unique ID.

## Response `201`

Created

- CustomResolver
  - `on_type` string, required — The name of the resolver's parent type. This can be `"Query"`, `"Mutation"`, or the name of a generated type if this is a computed property.
  - `field_name` string, required — The name of the custom resolver field that appears in the GraphQL schema.
  - `input_type` union — The type of the custom resolver's `input` parameter. This can be a scalar, the name of an existing generated type, or a custom JSON schema object. If undefined, the resolver does not accept an input.
    - string
    - object
  - `input_type_format` 'scalar' | 'scalar-list' | 'generated' | 'generated-list' | 'custom' — The kind of input type the custom resolver uses. This value must agree with the value of `input_type`: - A scalar input type must use `"scalar"` or `"scalar-list"` - A generated input type must use `"generated"` or `"generated-list"` - A custom input type must use `"custom"` If undefined, the resolver does not accept an input.
  - `payload_type` union — The type of the value returned by the custom resolver. This can be a scalar, the name of an existing generated type, or a custom JSON schema object. If undefined, the resolver returns a `DefaultPayload` object: ```graphql type DefaultPayload { status: String! } ```
    - string
    - object
  - `payload_type_format` 'scalar' | 'scalar-list' | 'generated' | 'generated-list' | 'custom' — The kind of payload type the custom resolver uses. This value must agree with the value of `payload_type`: - A scalar payload type must use `"scalar"` or `"scalar-list"` - A generated payload type must use `"generated"` or `"generated-list"` - A custom payload type must use `"custom"` If undefined, the resolver returns a `DefaultPayload` object.
  - `_id` string, required — The custom resolver's unique ID.
  - `function_id` string, required — The resolver function's unique ID.

## Changes

- **2024-02-20** (v3) `e2240dd053bd` — 7 breaking, 12 warning, 1 info
  - added `#/components/schemas/BaseCustomResolver, subschema #2` to the request body `allOf` list
  - the request's body type changed from `object` to no type
  - the response's body type changed from `object` to no type for status `201`
  - removed the required property `_id` from the response with the `201` status
  - …16 more

[Change history](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/changes/groups/:groupId/apps/:appId/graphql/custom_resolvers/post.md)

---

[API](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api.md) · [All operations](https://skmtc.dev/mongodb/apis/mongodb-atlas-app-services-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/mongodb/mongodb-atlas-app-services-admin-api/revisions/1365ab72bc03/schema)
