> ## 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 upload

> Create a pending upload at a project path and return the signed URL and headers for the PUT request that sends the bytes.

`createUpload(input: CreateUploadInput!): UploadSession!`

Requires project.uploads.write.

## Arguments

| Argument | Type | Required |
| - | - | - |
| `input` | [`CreateUploadInput!`](https://veryfront.com/docs/cloud/graphql/types/createuploadinput) | Yes |

## Input fields

### input

[`CreateUploadInput`](https://veryfront.com/docs/cloud/graphql/types/createuploadinput)

| Field | Type | Required | Description |
| - | - | - | - |
| `projectReference` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Project UUID, slug or configured domain. |
| `path` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Yes | Project-relative destination path, for example assets/image.png. Leading slashes are stripped. |
| `contentType` | [`String`](https://veryfront.com/docs/cloud/graphql/types/string) | No | MIME type; it becomes a required header of the PUT request. |
| `sizeBytes` | [`Float!`](https://veryfront.com/docs/cloud/graphql/types/float) | Yes | File size in bytes, a positive integer of at most 9007199254740991, checked against the storage quota. |

## Response

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

| Field | Type | Description |
| - | - | - |
| `uploadId` | [`ID!`](https://veryfront.com/docs/cloud/graphql/types/id) | UUID of the pending upload. |
| `path` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Project-relative path of the upload. |
| `uploadUrl` | [`String!`](https://veryfront.com/docs/cloud/graphql/types/string) | Short-lived signed URL for the PUT request that sends the bytes. |
| `requiredHeaders` | [`StringMap!`](https://veryfront.com/docs/cloud/graphql/types/stringmap) | Headers the PUT request must send. |
| `status` | [`UploadMetadataStatus!`](https://veryfront.com/docs/cloud/graphql/types/uploadmetadatastatus) | Always pending until the bytes are stored. |

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 CreateUpload($input: CreateUploadInput!) {
  createUpload(input: $input) {
    status
    path
    requiredHeaders
    uploadId
    uploadUrl
  }
}
```

```json title="variables.json" theme={null}
{
  "input": {
    "projectReference": "00000000-0000-4000-8000-000000000001",
    "path": "example",
    "sizeBytes": 0
  }
}
```

<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.