> ## Documentation Index
> Fetch the complete documentation index at: https://domoinc-openapi-sync-dataflows.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Engine API

This API reference is useful if you are wanting to use your Code Engine functions **outside** of your Domo instance.

<Note>
  Calling From *Inside* Domo

  To call the Code Engine API from *inside* your Domo instance, you can use

  * [a Pro-code app](/portal/Apps/App-Framework/Guides/hitting-code-engine-from-an-app)
  * [a Workflow](/s/article/000005331?language=en_US#create_workflow_from_template)
    * You can call that Workflow using [a button in an App Studio app](/s/article/000005295?language=en_US#add_a_button).
</Note>

Each function in Code Engine is a serverless function that can be run on demand. You can pass in input variables and get back a result. You can also choose to get logs from the function execution.

If you are unfamiliar, you'll need to familiarize yourself with [how to authenticate against Product APIs](/portal/API-Reference/overview#product-apis).

## Run Function

**Method**: `POST`\
**Endpoint**: `/api/codeengine/v2/packages/{{packageId}}/versions/{{version}}/functions/{{functionName}}`

**Example**:

```json theme={"dark"}
{
  "method": "POST",
  "url": "https://{instance}.domo.com/api/codeengine/v2/packages/756f0b19-5125-44f6-b541-058980ff6a94/versions/1.0.1/functions/getExecutionDetails",
  "headers": {
    "X-DOMO-Developer-Token": "",
    "Content-Type": "application/json"
  },
  "body": {
    "inputVariables": {
        "paramName": any // these should match your function input parameters
    },
    "settings": { "getLogs": boolean }
  }
}
```

**Response**:

```json theme={"dark"}
  HTTP/1.1 200 OK
  Content-Type: application/json;charset=UTF-8
{
    "executionId": string,
    "packageId": string,
    "version": string,
    "functionName": string,
    "status": string,
    "settings": {
        "getLogs": boolean
    },
    "startedOn": Date,
    "startedBy": string,
    "completedOn": Date,
    "result": any,
    "stdout": {
        "log": any[]
    },
    "stderr": {
        "log": any[]
    },
    "errorInformation": {
        "result": any,
        "expectedType": string,
        "actualType": string,
        "expectedIsList": boolean,
        "actualIsList": boolean,
        "expectedAllowNull": boolean,
        "errorMessages": string[]
    }
}
```
