---
title: "Execute a function"
method: POST
path: "/groups/{groupId}/apps/{appId}/debug/execute_function"
tags: ["functions"]
---

# Execute a function

`POST /groups/{groupId}/apps/{appId}/debug/execute_function`

Execute a [function](https://www.mongodb.com/docs/atlas/app-services/functions/) for testing.

## Query parameters

- `user_id` string, required
- `run_as_system` boolean, required

## Request body

- object
  - `service` string — The service to use when calling this function.
  - `name` string, required — The name of the function you want to run.
  - `arguments` string[] — Any arguments that your function needs.

## Response `200`

Successfully executed.

- object
  - `error` object
  - `logs` unknown
  - `result` object
  - `stats` object
    - `execution_time` string

---

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