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

Read a run with its status, input, output, error, and cost.

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
{
  "run": {
    "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"])

result = client.functions.runs.get("open-pr-count", "...")
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.runs.get("open-pr-count", '...');
console.log(result);
```

### cURL

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

### Response schema

```json
{
  "properties": {
    "run": {
      "properties": {
        "cost": {
          "properties": {
            "charged": {
              "default": 0,
              "type": "integer"
            },
            "cpu": {
              "default": 0,
              "type": "integer"
            },
            "fee": {
              "default": 0,
              "type": "integer"
            },
            "llm": {
              "properties": {
                "all": {
                  "properties": {
                    "claude_subscription": {
                      "default": 0,
                      "type": "integer"
                    },
                    "codex_subscription": {
                      "default": 0,
                      "type": "integer"
                    },
                    "platform": {
                      "default": 0,
                      "type": "integer"
                    },
                    "total": {
                      "default": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "claude_subscription",
                    "codex_subscription",
                    "platform",
                    "total"
                  ],
                  "type": "object"
                },
                "by_model": {
                  "items": {
                    "properties": {
                      "claude_subscription": {
                        "type": "integer"
                      },
                      "codex_subscription": {
                        "type": "integer"
                      },
                      "model": {
                        "type": "string"
                      },
                      "platform": {
                        "type": "integer"
                      },
                      "total": {
                        "type": "integer"
                      }
                    },
                    "required": [
                      "claude_subscription",
                      "codex_subscription",
                      "model",
                      "platform",
                      "total"
                    ],
                    "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": [
                    {
                      "additionalProperties": true,
                      "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"
    }
  },
  "required": [
    "run"
  ],
  "type": "object"
}
```
