---
title: "Get a function's source files"
method: GET
path: "/functions/{id}/source"
tags: ["Functions"]
---

# Get a function's source files

`GET /functions/{id}/source`

## Request

- Base URL: `https://api.primitive.dev/v1`
- URL: `https://api.primitive.dev/v1/functions/{id}/source`
- Auth: HTTP bearer

The source files of a managed-build deployment: the current one, or the one named by deployment_id. A function deployed as a single bundled module returns its deploymentId with an empty files list. deploymentId is null only when the function has no deployment.

## Path parameters

- `id` string, uuid, required

## Query parameters

- `deployment_id` string, uuid

## Response `200`

Get a function's source files

- object
  - `success` true, required
  - `data` GetFunctionSourceResult, required
    - `deploymentId` string, uuid, nullable, required
    - `files` object[], required
      - `path` string, required
      - `content` string, required
      - `bytes` integer, required
      - `sha256` string, required

## Other responses

- `400`: Invalid request parameters
- `401`: Invalid or missing API key
- `403`: Authenticated caller lacks permission for the operation
- `404`: Resource not found
- `429`: Rate limit exceeded. The `ratelimit-*` headers describe the limiter that rejected this request, with its own limit and window, not the API budget that successful responses report. A limiter that reports only a wait sends `Retry-After` alone.

---

[API](https://skmtc.dev/primitive/apis/primitive-api.md) - [All operations](https://skmtc.dev/primitive/apis/primitive-api/llms.txt) - [OpenAPI document](https://skmtc.dev/primitive/apis/primitive-api/revisions/bce409c97acb?raw)
