# createUpload

```graphql
mutation CreateUpload($input: CreateUploadInput!) {
  createUpload(input: $input) {
    uploadId
    path
    uploadUrl
    requiredHeaders
    status
  }
}
```

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

## Arguments

| Name                     | Type               | Required | Description                                                                                            |
| ------------------------ | ------------------ | -------- | ------------------------------------------------------------------------------------------------------ |
| `input`                  | CreateUploadInput! | Yes      |                                                                                                        |
| `input.projectReference` | String!            | Yes      | Project UUID, slug or configured domain.                                                               |
| `input.path`             | String!            | Yes      | Project-relative destination path, for example assets/image.png. Leading slashes are stripped.         |
| `input.contentType`      | String             |          | MIME type; it becomes a required header of the PUT request.                                            |
| `input.sizeBytes`        | Float!             | Yes      | File size in bytes, a positive integer of at most 9007199254740991, checked against the storage quota. |

## Variables

```json
{
  "input": {
    "projectReference": "string",
    "path": "string",
    "sizeBytes": 1
  }
}
```

## Responses

| Status | Description                              |
| ------ | ---------------------------------------- |
| 200    | The UploadSession! in data.createUpload. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation CreateUpload($input: CreateUploadInput!) {\n  createUpload(input: $input) {\n    uploadId\n    path\n    uploadUrl\n    requiredHeaders\n    status\n  }\n}",
  "variables": {
    "input": {
      "projectReference": "string",
      "path": "string",
      "sizeBytes": 1
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "createUpload": {
      "uploadId": "string",
      "path": "string",
      "uploadUrl": "https://example.com",
      "requiredHeaders": {},
      "status": "pending"
    }
  }
}
```
