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

# Create external file

> Create external file.

`createExternalFile(projectReference: String!, provider: ExternalFileProvider!, input: CreateExternalFileInput!): ExternalStorageFile!`

Requires project.integrations.connect.

## Arguments

| Argument | Type | Required | Description |
| - | - | - | - |
| `projectReference` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Project ID or slug. Requires project.integrations.connect through the caller's own personal provider connection. |
| `provider` | [`ExternalFileProvider!`](https://veryfront.com/docs/cloud/graphql/types/externalfileprovider) | Yes | Storage provider accessed through the caller's own personal connection. A human caller is required; agent, run, and service-account credentials are refused. |
| `input` | [`CreateExternalFileInput!`](https://veryfront.com/docs/cloud/graphql/types/createexternalfileinput) | Yes | |

## Input fields

### input

[`CreateExternalFileInput`](https://veryfront.com/docs/cloud/graphql/types/createexternalfileinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `folderId` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Parent folder item ID or root. |
| `name` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Creates a new file without replacing an existing one. OneDrive and SharePoint return conflict for an existing name; Google Drive creates a new item with the same name. File name, 1-255 characters without a slash. |
| `content` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | File content, at most 10,000,000 characters as sent. |
| `contentEncoding` | [`ExternalFileContentEncoding`](https://veryfront.com/docs/cloud/graphql/types/externalfilecontentencoding) | No | utf8 (default) or base64. |
| `mimeType` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | MIME type; derived from the name when omitted. |
| `idempotencyKey` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | 1-128 characters without whitespace. A retry with the same key and input within 24 hours returns the first file instead of creating another. |

## Response

Returns [`ExternalStorageFile!`](https://veryfront.com/docs/cloud/graphql/types/externalstoragefile). Open the type for its fields and nested types.

| Field | Type | Description |
| - | - | - |
| `id` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | |
| `provider` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Provider that stores the item: onedrive, sharepoint or drive. |
| `name` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `path` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `mimeType` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `sizeBytes` | [`Float!`](https://veryfront.com/docs/cloud/graphql/types/float) | |
| `kind` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | |
| `parentId` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | Provider ID of the parent folder, or null. |

[All fields of `ExternalStorageFile`](https://veryfront.com/docs/cloud/graphql/types/externalstoragefile).

Types marked with `!` cannot be null. Lists use `[Type]` notation. The [type index](https://veryfront.com/docs/cloud/graphql/schema.md) lists all published input and response types.

## Example

```graphql title="query.graphql" theme={null}
mutation CreateExternalFile($projectReference: String!, $provider: ExternalFileProvider!, $input: CreateExternalFileInput!) {
  createExternalFile(projectReference: $projectReference, provider: $provider, input: $input) {
    id
    name
    etag
    kind
    mimeType
  }
}
```

```json title="variables.json" theme={null}
{
  "projectReference": "example-project",
  "provider": "drive",
  "input": {
    "folderId": "root",
    "name": "notes.txt",
    "content": "hello",
    "contentEncoding": "utf8"
  }
}
```

<details>
  <summary>Try this mutation</summary>

  Calls use `https://api.veryfront.com/graphql`. Replace sample values with resources you can access. See [Authentication](https://veryfront.com/docs/cloud/authentication.md) for credentials and permissions.

  Bearer token or API key

  Stored in this tab's session. Clear credential

  Mutation

  Variables (JSON)
</details>


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