## GET /v1/functions/{id}

Read a function definition.

Required permissions: read:functions.
API key: Supported.
CLI user token: Supported.
Session token: Not supported by session tokens, even with permissions.ellipsis enabled.
Higher permission levels include lower levels: read < write < delete.

### Response

```text
{
  "function": {
    "config": {
      "ellipsis": {
        "description": str,
        "enabled": bool,
        "kind": "function",
        "metadata": {
          "annotations": {
            "[str]": str
          },
          "labels": [
            str
          ]
        },
        "name": str,
        "version": str
      },
      "function": {
        "code": str,
        "environment": { # str
          "compute": {
            "cpu": int,
            "idle": str,
            "memory": { # str | null
              "gb": int,
              "mb": int
            },
            "timeout": str
          },
          "hooks": {
            "after_checkout": { # str | null
              "run": str
            },
            "before_start": { # str | null
              "run": str
            },
            "build_base": { # str | null
              "inputs": [
                str
              ],
              "run": str
            },
            "post_clone": str,
            "post_start": str,
            "validate": { # str | null
              "run": str
            }
          },
          "mcp": [ # list[str | McpServerRef | McpRemoteServer |
          # McpCommandServer]
            {
              "args": [
                str
              ],
              "command": str,
              "env": {
                "[str]": str
              },
              "name": str
            }
          ],
          "repositories": [
            {
              "name": str,
              "owner": str,
              "ref": str
            }
          ],
          "variables": [
            {
              "name": str,
              "value": str
            }
          ]
        },
        "handler": str,
        "interpreter": str,
        "output": {
          "json_schema": {
            "[str]": any
          }
        },
        "permissions": {
          "ellipsis": [ # str | null | list[str | EllipsisGrant]
            {
              "allow": [ # str
                str
              ]
            }
          ],
          "github": [ # str | null | list[str | GithubGrant]
            {
              "allow": [ # str
                str
              ],
              "base": str,
              "branch": str,
              "issue": [ # int | null
                int
              ],
              "limit": int,
              "pull_request": [ # int | null
                int
              ],
              "repository": [ # str | null
                str
              ]
            }
          ]
        },
        "timeout": str
      },
      "input": {
        "json_schema": {
          "[str]": any
        }
      },
      "trigger": { # null | FunctionReactTrigger | FunctionCronTrigger
        "check_run": {
          "branch": [
            str
          ],
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "names": [
            str
          ],
          "on": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "check_suite": {
          "apps": [
            str
          ],
          "branch": [
            str
          ],
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "on": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "enabled": bool,
        "input": {
          "[str]": any
        },
        "issue": {
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "labels": [
            str
          ],
          "on": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "linear_issue": {
          "assignee": { # null | list[str] | str
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          },
          "changed": {
            "assignee": {
              "from": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              },
              "to": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              }
            },
            "labels": {
              "added": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              },
              "removed": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              }
            },
            "priority": {
              "from": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              },
              "to": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              }
            },
            "project": {
              "from": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              },
              "to": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              }
            },
            "state": {
              "from": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              },
              "to": { # null | list[str] | str
                "exclude": [
                  str
                ],
                "include": [
                  str
                ]
              }
            }
          },
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "labels": { # null | list[str] | str
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          },
          "on": [
            str
          ],
          "priority": { # null | list[str] | str
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          },
          "project": { # null | list[str] | str
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          },
          "state": { # null | list[str] | str
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          },
          "team": { # null | list[str] | str
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "pull_request": {
          "base": [
            str
          ],
          "draft": bool,
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "head": [
            str
          ],
          "labels": [
            str
          ],
          "on": [
            str
          ],
          "paths": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "push": {
          "branch": [
            str
          ],
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "paths": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "release": {
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "on": [
            str
          ],
          "prerelease": bool,
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          },
          "tag": [
            str
          ]
        },
        "sentry": {
          "on": [
            str
          ],
          "projects": [
            str
          ]
        },
        "slack_channel": {},
        "status": {
          "branch": [
            str
          ],
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "names": [
            str
          ],
          "on": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        },
        "type": "react",
        "workflow_run": {
          "branch": [
            str
          ],
          "for": {
            "bots": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            },
            "teams": [
              str
            ],
            "users": { # bool | list[str]
              "exclude": [
                str
              ],
              "include": [ # bool
                str
              ]
            }
          },
          "names": [
            str
          ],
          "on": [
            str
          ],
          "repositories": { # list[str]
            "exclude": [
              str
            ],
            "include": [
              str
            ]
          }
        }
      }
    },
    "created_at": str,
    "edited_by": {
      "avatar_url": str,
      "id": int,
      "login": str,
      "name": str,
      "type": str
    },
    "id": str,
    "last_sync_error": str,
    "last_synced_commit_sha": str,
    "listed": bool,
    "managed_by": str,
    "name": str,
    "next_run_at": str,
    "pending_pull_request_url": str,
    "raw_yaml": str,
    "sha": str,
    "source_details": {
      "branch": str,
      "path": str,
      "repo_id": int
    },
    "updated_at": str
  }
}
```

### Python

```python
import os

from ellipsis import Ellipsis

client = Ellipsis(api_key=os.environ["ELLIPSIS_API_TOKEN"])

result = client.functions.get("...")
print(result)
```

### TypeScript

```typescript
import { Ellipsis } from '@ellipsis-dev/sdk';

const client = new Ellipsis({
  apiKey: process.env.ELLIPSIS_API_TOKEN!,
});

const result = await client.functions.get('...');
console.log(result);
```

### cURL

```bash
curl "https://api.ellipsis.dev/v1/functions/{id}" \
  -H "Authorization: Bearer $ELLIPSIS_API_TOKEN"
```

### Response schema

```json
{
  "properties": {
    "function": {
      "properties": {
        "config": {
          "additionalProperties": false,
          "properties": {
            "ellipsis": {
              "additionalProperties": false,
              "properties": {
                "description": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "enabled": {
                  "default": true,
                  "type": "boolean"
                },
                "kind": {
                  "const": "function",
                  "type": "string"
                },
                "metadata": {
                  "additionalProperties": false,
                  "properties": {
                    "annotations": {
                      "items": {
                        "type": "string"
                      },
                      "default": {},
                      "type": "object"
                    },
                    "labels": {
                      "default": [],
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "annotations",
                    "labels"
                  ],
                  "type": "object",
                  "x-ellipsis-returned-form-of": "ConfigMetadata"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "version": {
                  "default": "v1",
                  "type": "string"
                }
              },
              "required": [
                "kind"
              ],
              "type": "object",
              "x-ellipsis-returned-form-of": "FunctionIdentity"
            },
            "function": {
              "additionalProperties": false,
              "properties": {
                "code": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "environment": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "compute": {
                          "type": "object"
                        },
                        "hooks": {
                          "type": "object"
                        },
                        "mcp": {
                          "type": "array"
                        },
                        "repositories": {
                          "type": "array"
                        },
                        "variables": {
                          "type": "array"
                        }
                      },
                      "required": [
                        "compute",
                        "hooks",
                        "mcp",
                        "repositories",
                        "variables"
                      ],
                      "type": "object",
                      "x-ellipsis-returned-form-of": "EnvironmentConfig"
                    }
                  ]
                },
                "handler": {
                  "type": "string"
                },
                "interpreter": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "output": {
                  "anyOf": [
                    {
                      "additionalProperties": false,
                      "properties": {
                        "json_schema": {
                          "type": "object"
                        }
                      },
                      "required": [
                        "json_schema"
                      ],
                      "type": "object"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "permissions": {
                  "additionalProperties": false,
                  "properties": {
                    "ellipsis": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "github": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "array"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "ellipsis",
                    "github"
                  ],
                  "type": "object",
                  "x-ellipsis-returned-form-of": "PermissionsConfig"
                },
                "timeout": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "code",
                "environment",
                "handler",
                "interpreter",
                "output",
                "permissions",
                "timeout"
              ],
              "type": "object",
              "x-ellipsis-returned-form-of": "FunctionSettings"
            },
            "input": {
              "anyOf": [
                {
                  "additionalProperties": false,
                  "properties": {
                    "json_schema": {
                      "additionalProperties": true,
                      "type": "object"
                    }
                  },
                  "required": [
                    "json_schema"
                  ],
                  "type": "object"
                },
                {
                  "type": "null"
                }
              ]
            },
            "trigger": {
              "anyOf": [
                {
                  "oneOf": [
                    {
                      "additionalProperties": false,
                      "properties": {
                        "enabled": {
                          "type": "boolean"
                        },
                        "input": {
                          "type": "object"
                        },
                        "schedule": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "enabled",
                        "schedule",
                        "input"
                      ],
                      "type": "object",
                      "x-ellipsis-returned-form-of": "FunctionCronTrigger"
                    },
                    {
                      "additionalProperties": false,
                      "properties": {
                        "check_run": {
                          "type": "object"
                        },
                        "check_suite": {
                          "type": "object"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "input": {
                          "type": "object"
                        },
                        "issue": {
                          "type": "object"
                        },
                        "linear_issue": {
                          "type": "object"
                        },
                        "pull_request": {
                          "type": "object"
                        },
                        "push": {
                          "type": "object"
                        },
                        "release": {
                          "type": "object"
                        },
                        "sentry": {
                          "type": "object"
                        },
                        "slack_channel": {
                          "type": "object"
                        },
                        "status": {
                          "type": "object"
                        },
                        "type": {
                          "type": "string"
                        },
                        "workflow_run": {
                          "type": "object"
                        }
                      },
                      "required": [
                        "type",
                        "enabled",
                        "pull_request",
                        "push",
                        "issue",
                        "check_run",
                        "check_suite",
                        "workflow_run",
                        "status",
                        "release",
                        "linear_issue",
                        "sentry",
                        "slack_channel",
                        "input"
                      ],
                      "type": "object",
                      "x-ellipsis-returned-form-of": "FunctionReactTrigger"
                    }
                  ]
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "ellipsis",
            "function"
          ],
          "type": "object",
          "x-ellipsis-returned-form-of": "FunctionConfig"
        },
        "created_at": {
          "format": "date-time",
          "type": "string"
        },
        "edited_by": {
          "anyOf": [
            {
              "properties": {
                "avatar_url": {
                  "type": "string"
                },
                "id": {
                  "type": "integer"
                },
                "login": {
                  "type": "string"
                },
                "name": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "type": {
                  "enum": [
                    "User",
                    "Organization",
                    "Bot",
                    "Mannequin"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "avatar_url",
                "id",
                "login",
                "name",
                "type"
              ],
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "id": {
          "type": "string"
        },
        "last_sync_error": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_synced_commit_sha": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "listed": {
          "default": true,
          "type": "boolean"
        },
        "managed_by": {
          "enum": [
            "github",
            "api",
            "session"
          ],
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "next_run_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "pending_pull_request_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "raw_yaml": {
          "type": "string"
        },
        "sha": {
          "type": "string"
        },
        "source_details": {
          "anyOf": [
            {
              "properties": {
                "branch": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "repo_id": {
                  "type": "integer"
                }
              },
              "required": [
                "repo_id",
                "path",
                "branch"
              ],
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "updated_at": {
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "id",
        "name",
        "sha",
        "created_at",
        "updated_at",
        "managed_by",
        "config",
        "raw_yaml"
      ],
      "type": "object"
    }
  },
  "required": [
    "function"
  ],
  "type": "object"
}
```
