> For the complete documentation index, see [llms.txt](https://docs.planetcrust.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.planetcrust.com/human-connections/claude-ai/claude-ai/action-upload-file.md).

# Action: Upload File

<p align="center"><a class="button primary" data-icon="circle-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscriptions</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>

<figure><img src="/files/sQzwwa4W9NWTWOhdafeH" alt=""><figcaption></figcaption></figure>

<p align="center">Upload a file to the Claude API</p>

{% embed url="<https://www.youtube.com/watch?v=CyuUuaBSZzA>" %}

#### Example User Story

As a developer, I want to upload a file to the Claude API so that I can use it for fine-tuning or other purposes.

#### Fields

| Field Name | Field Type | Required |
| ---------- | ---------- | -------- |
| file       | File       | Yes      |
| purpose    | String     | No       |

### Related Connections

### Related Automations

Example link

### Code (Apache v2.0): Operation

```
{
  "handle": "upload-file",
  "state": "inDev",
  "meta": {
    "short": "Upload File",
    "description": "Uploads a file to the Claude API."
  },
  "input": [
    {
      "name": "file",
      "type": "File",
      "required": true,
      "meta": {
        "description": "The file to upload."
      }
    },
    {
      "name": "purpose",
      "type": "String",
      "required": false,
      "meta": {
        "description": "The intended purpose of the uploaded file.",
        "default": "fine-tune"
      }
    }
  ],
  "output": [
    {
      "name": "id",
      "type": "String",
      "selector": ["id"],
      "meta": {
        "description": "The unique identifier of the uploaded file."
      }
    },
    {
      "name": "status",
      "type": "String",
      "selector": ["status"],
      "meta": {
        "description": "The status of the uploaded file."
      }
    },
    {
      "name": "bytes",
      "type": "Integer",
      "selector": ["bytes"],
      "meta": {
        "description": "The size of the uploaded file in bytes."
      }
    }
  ],
  "steps": [
    {
      "type": "http",
      "http": {
        "method": "POST",
        "path": "/v1/files",
        "headers": {
          "Content-Type": "multipart/form-data"
        },
        "bodyTemplate": {
          "value": "--boundary\\r\\nContent-Disposition: form-data; name=\"file\"; filename=\"{{file.name}}\"\\r\\nContent-Type: {{file.type}}\\r\\n\\r\\n{{file.content}}\\r\\n--boundary--\\r\\n--boundary\\r\\nContent-Disposition: form-data; name=\"purpose\"\\r\\n\\r\\n{{purpose}}\\r\\n--boundary--",
          "placeholders": [
            {
              "name": "file",
              "type": "File",
              "description": "The file to upload.",
              "required": true
            },
            {
              "name": "purpose",
              "type": "String",
              "description": "The intended purpose of the uploaded file.",
              "required": false,
              "default": "fine-tune"
            }
          ]
        }
      }
    }
  ]
}

```

<p align="center"><a class="button primary" data-icon="square-caret-right">Try @Human</a><a class="button primary" data-icon="check">Buy @Human Subscription</a><a class="button primary" data-icon="comments">Join @Human Community</a></p>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.planetcrust.com/human-connections/claude-ai/claude-ai/action-upload-file.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
