Import a file onto a page (import)
import_attachmentUpload a local file or URL as an attachment to an imported page under a chosen uuid, idempotent by source_id. Use after import_create_space to migrate Confluence attachments.
Instructions
Needs a token with the import:write scope whose owner is a global admin. Nothing is emailed or notified, and no per-row audit events are written. Only works in a space created with import_create_space (otherwise 403 IMPORT_SPACE_NOT_IMPORTED). Upload a file to an imported page under the uuid you chose (the one written in the body as ; by default derived from source_id, see import_ids). Give exactly one source: path (a local file) or url (downloaded to a temporary file with a size cap; for URLs on ATLASSIAN_SITE_URL it signs in with ATLASSIAN_EMAIL + ATLASSIAN_API_TOKEN, and those credentials are never sent to any other host, redirects included). Idempotent by source_id. Run import_check_page afterwards to find files that are still missing. The server decides the accepted types and says so when it refuses one.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"page_id": "<page_id>",
"source_id": "<source_id>",
"uploaded_by_user_id": "<uploaded_by_user_id>",
"created_at": "<created_at>"
},
"name": "import_attachment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | The attachment uuid written in the body. Defaults to the deterministic id import_ids gives for source_id. | |
| url | No | A URL to download (a Confluence attachment URL, for instance). | |
| path | No | Absolute path of a local file. | |
| page_id | Yes | Sophia page id (uuid), from get_page_tree, search_pages or recent_pages. | |
| file_name | No | Defaults to the name in the path or URL. | |
| source_id | Yes | The id of this attachment in Confluence. Importing the same source id again changes nothing. | |
| created_at | Yes | ISO 8601 date-time, e.g. 2023-05-02T10:11:12.000Z. | |
| content_type | No | Defaults to what the server or the extension says. | |
| uploaded_by_user_id | Yes | Sophia user id (uuid) from import_find_users or import_ensure_user. |