## GET /v1/functions/{id}/runs

List the runs of a function, newest first. Page with limit and cursor.

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
{
  "has_more": bool,
  "next_cursor": str,
  "runs": [
    {
      "cost": {
        "charged": int,
        "cpu": int,
        "fee": int,
        "llm": {
          "all": {
            "claude_subscription": int,
            "codex_subscription": int,
            "platform": int,
            "total": int
          },
          "by_model": [
            {
              "claude_subscription": int,
              "codex_subscription": int,
              "model": str,
              "platform": int,
              "total": int
            }
          ]
        },
        "memory": int,
        "total": int
      },
      "created_at": str,
      "ended_at": str,
      "error": {
        "detail": str,
        "reason": str
      },
      "event": {
        "body": {
          "[str]": any
        },
        "headers": {
          "[str]": str
        },
        "integration": str
      },
      "function": {
        "id": str,
        "name": str,
        "sha": str
      },
      "id": str,
      "input": {
        "[str]": any
      },
      "output": {
        "result": {
          "[str]": any
        }
      },
      "session": {
        "id": str
      },
      "source": str,
      "started_at": str,
      "status": str,
      "user": {
        "avatar_url": str,
        "id": str,
        "name": str
      }
    }
  ]
}
```

### Python

```python
import os

from ellipsis import Ellipsis

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

for item in client.functions.runs.list("..."):
    print(item)
```

### TypeScript

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

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

for await (const item of await client.functions.runs.list('...')) {
  console.log(item);
}
```

### cURL

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

### Response schema

```json
{
  "properties": {
    "has_more": {
      "default": false,
      "type": "boolean"
    },
    "next_cursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "runs": {
      "items": {
        "properties": {
          "cost": {
            "properties": {
              "charged": {
                "default": 0,
                "type": "integer"
              },
              "cpu": {
                "default": 0,
                "type": "integer"
              },
              "fee": {
                "default": 0,
                "type": "integer"
              },
              "llm": {
                "properties": {
                  "all": {
                    "properties": {
                      "claude_subscription": {
                        "type": "integer"
                      },
                      "codex_subscription": {
                        "type": "integer"
                      },
                      "platform": {
                        "type": "integer"
                      },
                      "total": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "claude_subscription",
                      "codex_subscription",
                      "platform",
                      "total"
                    ],
                    "type": "object"
                  },
                  "by_model": {
                    "items": {
                      "type": "object"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "all",
                  "by_model"
                ],
                "type": "object"
              },
              "memory": {
                "default": 0,
                "type": "integer"
              },
              "total": {
                "default": 0,
                "type": "integer"
              }
            },
            "required": [
              "charged",
              "cpu",
              "fee",
              "llm",
              "memory",
              "total"
            ],
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "ended_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "anyOf": [
              {
                "properties": {
                  "detail": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "reason": {
                    "enum": [
                      "error",
                      "timeout",
                      "handler_failed",
                      "invalid_output",
                      "lifecycle_hook_failed",
                      "missing_environment_variables",
                      "missing_repo_access",
                      "missing_token_permissions",
                      "missing_github_integration",
                      "payment_required",
                      "blocked",
                      "contact_email_required",
                      "function_unavailable",
                      "interrupted",
                      "queue_full"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "event": {
            "anyOf": [
              {
                "properties": {
                  "body": {
                    "additionalProperties": true,
                    "type": "object"
                  },
                  "headers": {
                    "items": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "integration": {
                    "enum": [
                      "github",
                      "linear",
                      "slack",
                      "sentry"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "body",
                  "headers",
                  "integration"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "function": {
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "sha": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "sha"
            ],
            "type": "object"
          },
          "id": {
            "type": "string"
          },
          "input": {
            "additionalProperties": true,
            "type": "object"
          },
          "output": {
            "anyOf": [
              {
                "properties": {
                  "result": {
                    "anyOf": [
                      {
                        "type": "object"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "session": {
            "anyOf": [
              {
                "properties": {
                  "id": {
                    "type": "string"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "enum": [
              "react",
              "cron",
              "web",
              "api",
              "cli",
              "session"
            ],
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "enum": [
              "queued",
              "preparing",
              "running",
              "completed",
              "failed",
              "cancelled"
            ],
            "type": "string"
          },
          "user": {
            "anyOf": [
              {
                "properties": {
                  "avatar_url": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "avatar_url",
                  "id",
                  "name"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "status",
          "source",
          "function",
          "input",
          "cost",
          "created_at"
        ],
        "type": "object"
      },
      "type": "array"
    }
  },
  "required": [
    "runs"
  ],
  "type": "object"
}
```
