---
title: "Add a file to a running session [write]"
method: POST
path: "/sessions/{id}/resources"
tags: ["sessions"]
---

# Add a file to a running session \[write\]

`POST /sessions/{id}/resources`

## Request

- Base URL: `https://api.agentsky.dev/v1`
- URL: `https://api.agentsky.dev/v1/sessions/{id}/resources`
- Auth: HTTP bearer

Files only — repositories and memory stores can only be attached at session create. The file is copied read-only to `/workspace<mount_path>` before the session's next turn; `mount_path` follows the create rules (rooted under /workspace, no escape, no overlap with another resource). 400 too_many_resources past 500 per session; 400 session_archived on an archived session.

## Path parameters

- `id` string, required

## Request body

- union
  - object
    - `type` 'file', required
    - `file_id` string, required
    - `mount_path` string, nullable
  - object
    - `type` 'github_repository', required
    - `url` string, required
    - `authorization_token` string
    - `checkout` union
      - object
        - `type` 'branch', required
        - `name` string, required
      - object
        - `type` 'commit', required
        - `sha` string, required
    - `mount_path` string, nullable
  - object
    - `type` 'memory_store', required
    - `memory_store_id` string, required
    - `access` 'read_only' | 'read_write', required
    - `instructions` string
    - `mount_path` string, nullable

## Response `200`

OK

- union: A file, GitHub repository, or memory-store snapshot mounted read-only into the session. A read_write memory-store grant also permits updates through the session-scoped Agent API. Workspace paths are under /workspace; memory paths are under /mnt/memory. A file resource's `file_id` is the per-session copy (listed under GET /files?scope_id=). Repository tokens and memory contents are never echoed here.
  - object
    - `type` 'file', required
    - `id` string, required: sesrsc_…
    - `file_id` string, required: The per-session copy (file_…), read-only at mount_path
    - `mount_path` string, required: Absolute, under /workspace
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
  - object
    - `type` 'github_repository', required
    - `id` string, required: sesrsc_…
    - `url` string, required: https://github.com/{owner}/{repo}
    - `mount_path` string, required: Absolute, under /workspace; the clone's root
    - `checkout` object: {type:"branch", name} or {type:"commit", sha}; absent = the default branch
      - `type` 'branch' | 'commit'
      - `name` string
      - `sha` string
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
  - object
    - `type` 'memory_store', required
    - `id` string, required: smsr_…
    - `memory_store_id` string, required: memstore_…
    - `mount_path` string, required: Absolute, under /mnt/memory
    - `access` 'read_only' | 'read_write', required
    - `instructions` string: Optional per-session guidance
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required

## Other responses

- `default`: Error — { error: { code, message } }

## Changes

- **2026-11-02** `e5e8f0229a99`: 1 info
  - added the optional property `error/request_id` to the response with the `default` status

[Operation history](https://skmtc.dev/agentsky/apis/agentsky-developer-api/changes/sessions/:id/resources/post.md)

---

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