> ## Documentation Index
> Fetch the complete documentation index at: https://dialnexa.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Upload URL

> Use the create_upload_url MCP tool on the DialNexa remote MCP server.

Changes state - verify before retry

Prepares a secure, one-time upload slot for a real file that lives on a machine you control, so it never has to be pasted into the conversation: a PDF/text document for a knowledge base (kind kb\_document, target\_id = kb\_id), or a CSV/Excel leads file for a batch call (kind batch\_leads, target\_id = agent\_id). Returns an upload\_id valid for 10 minutes. Not needed for a file the user attached in the chat: that attachment goes in the `file` argument of the target tool (preview\_batch\_call\_leads, create\_batch\_call, upload\_knowledge\_base\_document). The file bytes are sent with an HTTP PUT by whoever holds the file. Set reveal\_url to true only when the caller performs that PUT itself (a command-line agent or script with internet access); the result then includes the URL and headers to use, and names the tool to call once the upload is done. Chat sandboxes without internet access cannot complete the PUT. No in-chat upload panel is available on this server, so the user cannot upload through the chat. Rule of thumb: content under \~50 KB that you already have goes inline as file\_text (or file\_base64 for a small .xlsx on disk); anything larger on your own disk comes through here. Nothing is stored until the file is actually uploaded.

## Parameters

| Name | Type | Required | Description |
| - | - | - | - |
| `kind` | enum: `kb_document` \| `batch_leads` | Yes | What the file is for: kb\_document or batch\_leads |
| `target_id` | `string` | Yes | The resource the file is for: kb\_id for kb\_document, agent\_id for batch\_leads |
| `file_name` | `string` | Yes | File name with extension, e.g. policy.pdf, leads.csv, leads.xlsx |
| `reveal_url` | `boolean` | No | Set true ONLY if you will perform the HTTP PUT yourself (CLI agent or script). Chat assistants leave this unset. |

## Complete input schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "kb_document",
        "batch_leads"
      ],
      "description": "What the file is for: kb_document or batch_leads"
    },
    "target_id": {
      "type": "string",
      "description": "The resource the file is for: kb_id for kb_document, agent_id for batch_leads"
    },
    "file_name": {
      "type": "string",
      "description": "File name with extension, e.g. policy.pdf, leads.csv, leads.xlsx"
    },
    "reveal_url": {
      "type": "boolean",
      "description": "Set true ONLY if you will perform the HTTP PUT yourself (CLI agent or script). Chat assistants leave this unset."
    }
  },
  "required": [
    "kind",
    "target_id",
    "file_name"
  ],
  "additionalProperties": false,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

## Registered output schema

```json theme={null}
{
  "type": "object",
  "properties": {
    "upload_id": {
      "type": "string",
      "description": "Opaque id to pass to the finalize tool once the file is uploaded"
    },
    "kind": {
      "type": "string",
      "description": "The upload kind"
    },
    "target_id": {
      "type": "string",
      "description": "The target id as given"
    },
    "file_name": {
      "type": "string",
      "description": "The sanitised file name the upload will be stored under"
    },
    "accepted_types": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Extensions accepted for this kind"
    },
    "max_bytes": {
      "type": "number",
      "description": "Maximum file size in bytes"
    },
    "expires_at": {
      "type": "string",
      "description": "When the upload URL stops working"
    },
    "finalize_tool": {
      "type": "string",
      "description": "Tool to call with upload_id after the file is uploaded"
    },
    "upload_host": {
      "type": "string",
      "description": "Present only when reveal_url is true: the host the file is PUT to, for callers that must allow it for outbound traffic"
    },
    "next_step": {
      "type": "string",
      "description": "What to do next"
    },
    "upload": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string"
        },
        "method": {
          "type": "string"
        },
        "headers": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      },
      "required": [
        "url",
        "method",
        "headers"
      ],
      "additionalProperties": false,
      "description": "Present only when reveal_url is true: where and how to PUT the bytes"
    }
  },
  "required": [
    "upload_id",
    "kind",
    "target_id",
    "file_name",
    "accepted_types",
    "max_bytes",
    "expires_at",
    "finalize_tool",
    "next_step"
  ],
  "additionalProperties": true,
  "$schema": "http://json-schema.org/draft-07/schema#"
}
```

## Before you call

* Connect and initialize the MCP client with OAuth or an API key for the intended workspace.
* Provide the required parameters: `kind`, `target_id`, `file_name`.
* If your OAuth grant covers several workspaces, also pass `organization_id` with the workspace to act in, from [List My Organizations](https://dialnexa.com/docs/mcp-tools/organization/list-my-organizations.md).

## Example MCP request

Send `tools/call` after your client completes MCP initialization. Replace placeholder values with IDs and inputs from your workspace. For object and array parameters, follow the nested requirements in the parameter description instead of treating an empty value as complete.

```json theme={null}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "create_upload_url",
    "arguments": {
      "kind": "kb_document",
      "target_id": "kb_abc123",
      "file_name": "support-faq.txt"
    }
  }
}
```

Successful results include `structuredContent` and a text content block containing the same JSON. Check `isError` first, then read `structuredContent` or parse `content[0].text`. See [MCP responses and errors](https://dialnexa.com/docs/mcp-tools/errors.md) for the full envelope and failure behavior.

## Verify the result

Confirm the response is not marked `isError`, upload the file to the returned slot, then call the returned `finalize_tool` with the `upload_id`. The slot itself creates nothing to read back.

## Retry safety

This tool changes workspace state. After a timeout, read the affected resource before retrying so you do not create duplicate or conflicting changes.

## Related MCP tools

* [Preview Batch Call Leads](https://dialnexa.com/docs/mcp-tools/batch-calls/preview-batch-call-leads.md): `preview_batch_call_leads`
* [Create Batch Call](https://dialnexa.com/docs/mcp-tools/batch-calls/create-batch-call.md): `create_batch_call`
* [Upload Knowledge Base Document](https://dialnexa.com/docs/mcp-tools/knowledge-base/upload-knowledge-base-document.md): `upload_knowledge_base_document`

## Related guides

* [Connect to the DialNexa MCP server](https://dialnexa.com/docs/mcp-tools/overview.md)
* [File Uploads MCP tools](https://dialnexa.com/docs/mcp-tools/uploads/overview.md)
* [MCP responses and errors](https://dialnexa.com/docs/mcp-tools/errors.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.