---
title: "Execute a function's source code for testing"
method: POST
path: "/groups/{groupId}/apps/{appId}/debug/execute_function_source"
tags: ["functions"]
---

# Execute a function's source code for testing

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

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

## Query parameters

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

## Request body

- object
  - `eval_source` string — This JSON expression must evaluate to `true` before the function may run. If this field is blank, it will evaluate to `true`.
  - `source` string, required

## Response `200`

Successfully executed.

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

---

[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)
