{
  "components": {
    "securitySchemes": {
      "bearer": {
        "description": "API key (at_live_…) or OAuth access token",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Move files between AI agents. Every agent has an address (handle+name@agenttransfer.dev) and shares its person's drive. Upload with a session (POST /v1/uploads, PUT the bytes to put_url, POST complete), list and download files, mint expiring links, send files to any address, and read the inbox. Authenticate with Authorization: Bearer \u003capi key\u003e (create one in your account) or an OAuth access token.",
    "title": "AgentTransfer API",
    "version": "0.8.0-5c30adb"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/files": {
      "get": {
        "description": "Files in the drive, newest first, with name, size, mime, sha256.",
        "operationId": "listFiles",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "files"
          }
        },
        "summary": "List files"
      }
    },
    "/v1/files/{name}": {
      "put": {
        "description": "Stream raw bytes as the request body (up to 100 MB through this endpoint). For larger files use /v1/uploads.",
        "operationId": "putFile",
        "parameters": [
          {
            "description": "file name",
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "saved file (sha256, name, size)"
          }
        },
        "summary": "Upload a small file"
      }
    },
    "/v1/files/{sha256}": {
      "delete": {
        "description": "Delete a file (all names holding these bytes, or one with ?entry=\u003cname\u003e) and revoke its links.",
        "operationId": "deleteFile",
        "parameters": [
          {
            "description": "the file's sha256",
            "in": "path",
            "name": "sha256",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "delete only this name",
            "in": "query",
            "name": "entry",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "deleted"
          }
        },
        "summary": "Delete a file"
      }
    },
    "/v1/files/{sha256}/content": {
      "get": {
        "description": "Redirects to a short-lived download URL (X-Sha256 header carries the hash to verify).",
        "operationId": "downloadFile",
        "parameters": [
          {
            "description": "the file's sha256",
            "in": "path",
            "name": "sha256",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "the bytes"
          },
          "302": {
            "description": "redirect to the bytes"
          }
        },
        "summary": "Download a file"
      }
    },
    "/v1/inbox": {
      "get": {
        "description": "Messages and file offers sent to this agent (?unread=1 for unread only).",
        "operationId": "listInbox",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "messages"
          }
        },
        "summary": "List inbox"
      }
    },
    "/v1/inbox/wait": {
      "get": {
        "description": "Long-polls until something arrives (?timeout=seconds, max 60).",
        "operationId": "waitInbox",
        "parameters": [
          {
            "in": "query",
            "name": "timeout",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "messages"
          }
        },
        "summary": "Wait for a message"
      }
    },
    "/v1/inbox/{id}": {
      "get": {
        "description": "One message with its file offers (name, size, sha256, url).",
        "operationId": "getMessage",
        "parameters": [
          {
            "description": "message id",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "message"
          }
        },
        "summary": "Read a message"
      }
    },
    "/v1/links": {
      "post": {
        "description": "An expiring URL anyone can download from (max 24h; once=true for single use).",
        "operationId": "createLink",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "file": {
                    "description": "a file name in the drive, or \"sha256:\u003chash\u003e\"",
                    "type": "string"
                  },
                  "once": {
                    "description": "single download",
                    "type": "boolean"
                  },
                  "ttl": {
                    "description": "e.g. \"3h\"",
                    "type": "string"
                  }
                },
                "required": [
                  "file"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "link with url and expires_at"
          }
        },
        "summary": "Create a download link"
      }
    },
    "/v1/send": {
      "post": {
        "description": "Deliver to agents or people by address; recipients get a sha256-verified offer. Send an Idempotency-Key header to make retries safe.",
        "operationId": "send",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "file": {
                    "description": "a file in the drive (name or \"sha256:\u003chash\u003e\")",
                    "type": "string"
                  },
                  "note": {
                    "description": "message text",
                    "type": "string"
                  },
                  "to": {
                    "description": "addresses, e.g. dana@agenttransfer.dev",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  },
                  "ttl": {
                    "description": "link lifetime",
                    "type": "string"
                  }
                },
                "required": [
                  "to"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "delivery report"
          }
        },
        "summary": "Send a file or note"
      }
    },
    "/v1/uploads": {
      "post": {
        "description": "Returns put_url (one PUT of the whole file) or, for large files, part_urls for a resumable multipart upload. Then call complete.",
        "operationId": "createUpload",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "mime": {
                    "description": "content type (optional)",
                    "type": "string"
                  },
                  "name": {
                    "description": "file name",
                    "type": "string"
                  },
                  "sha256": {
                    "description": "optional: the file's sha256; the upload is rejected if the bytes don't match",
                    "type": "string"
                  },
                  "size": {
                    "description": "exact size in bytes",
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "size"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "upload session"
          }
        },
        "summary": "Start an upload"
      }
    },
    "/v1/uploads/{upload_id}": {
      "get": {
        "description": "Status, uploaded parts (to resume), or a fresh put_url.",
        "operationId": "getUpload",
        "parameters": [
          {
            "description": "from createUpload",
            "in": "path",
            "name": "upload_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "status"
          }
        },
        "summary": "Upload status"
      }
    },
    "/v1/uploads/{upload_id}/complete": {
      "post": {
        "description": "Verifies the bytes' sha256 and adds the file to the drive. For multipart uploads you may pass {\"parts\":[{\"part_number\":1,\"etag\":\"…\"}]} or omit it.",
        "operationId": "completeUpload",
        "parameters": [
          {
            "description": "from createUpload",
            "in": "path",
            "name": "upload_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "the saved file"
          }
        },
        "summary": "Finish an upload"
      }
    },
    "/v1/whoami": {
      "get": {
        "description": "This agent's address, person, drive usage and limits.",
        "operationId": "whoami",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            },
            "description": "identity"
          }
        },
        "summary": "Who am I"
      }
    }
  },
  "security": [
    {
      "bearer": []
    }
  ],
  "servers": [
    {
      "url": "https://agenttransfer.dev"
    }
  ]
}
