---
title: How do I generate an SHA for uploading a file to the Vercel API?
description: When using the Vercel API to create a deployment, you first need to upload your files. An SHA is required to upload these files.
url: /kb/guide/how-do-i-generate-an-sha-for-uploading-a-file-to-the-vercel-api
canonical_url: "https://vercel.com/kb/guide/how-do-i-generate-an-sha-for-uploading-a-file-to-the-vercel-api"
published: 2025-11-03
last_updated: 2025-11-10
authors: Ismael Rumzan
related:
  - /docs/api
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---
<!-- docsgraph:related -->
## Related pages

> **For AI agents:** Follow these links to understand how this page connects to the rest of the Vercel ecosystem. For the full cross-link map (inbound, outbound, prerequisites, and semantic neighbors), see the .graph.md link below.

- [Deployments](https://vercel.com/docs/deployments?from=related) — Learn how to create and manage deployments on Vercel.
- [Upload Deployment Files](https://vercel.com/docs/rest-api/deployments/upload-deployment-files?from=related)
- [Deploying from CLI](https://vercel.com/docs/cli/deploying-from-cli?from=related) — Learn how to deploy your Vercel Projects from Vercel CLI using the vercel or vercel deploy commands.
- [GitLab](https://vercel.com/docs/git/vercel-for-gitlab?from=related) — ​Vercel for GitLab automatically deploys your GitLab projects with Vercel, providing Preview Deployment URLs, and automa
- [vercel curl](https://vercel.com/docs/cli/curl?from=related) — Learn how to make HTTP requests to your Vercel deployments with automatic deployment protection bypass using the vercel
- [How to Deploy a Jekyll Site with Vercel](https://vercel.com/kb/guide/deploying-jekyll-with-vercel?from=related) — Create a Jekyll website and deploy it live with Vercel.
- [How to Deploy a Hexo Blog with Vercel](https://vercel.com/kb/guide/deploying-hexo-with-vercel?from=related) — Create a Hexo blog and deploy it live with Vercel.
- [How to Deploy an Angular Site with Vercel](https://vercel.com/kb/guide/deploying-angular-with-vercel?from=related) — Create your Angular app and deploy it with Vercel.
- [How to Deploy an Aurelia App with Vercel](https://vercel.com/kb/guide/deploying-aurelia-with-vercel?from=related) — Create an Aurelia app and deploy it live with Vercel.
- [How to Deploy a Hugo Site with Vercel](https://vercel.com/kb/guide/deploying-hugo-with-vercel?from=related) — Create a Hugo website and deploy it live with Vercel.

Full cross-link map for this page: [/kb/guide/how-do-i-generate-an-sha-for-uploading-a-file-to-the-vercel-api.graph.md](/kb/guide/how-do-i-generate-an-sha-for-uploading-a-file-to-the-vercel-api.graph.md)
<!-- /docsgraph:related -->


When using the [Vercel API](https://vercel.com/docs/api) to [create a deployment](https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment), you first need to upload your files associated with this deployment. An `SHA` is required to upload each file. In this article, we describe how to generate the `SHA` for each file from the command line and then use it to upload the file to the Vercel **API**.

## Generate the `SHA` based on the file

On UNIX operating systems, the easiest way to do this is to use the built-in command `shasum`. For example, for a file named `vercel.json`, run the following command:

```bash
echo -n vercel.json | shasum
```

The `SHA` will be outputted in the command line. Copy it to a safe location.

## Use the `SHA` to upload the file

Next, you will use the `SHA` as the header `x-vercel-digest` for the [`POST` request with the Vercel API](https://vercel.com/docs/api#endpoints/deployments/upload-deployment-files). In the case of the `vercel.json` above, you can use the following `CURL` command:

```bash
curl --location --request POST 'https://api.vercel.com/v2/now/files' \
--header 'x-vercel-digest: `SHA`' \
--header 'Authorization: Bearer `mytoken`' \
--header 'Content-Type: text/plain' \
--data-raw '`content of the vercel.json file`'
```

The contents of the `vercel.json` in the command above is the exact copy and paste of the contents of the `vercel.json` file. The response will be `200` with an empty object.

## Create a deployment using this file

You are now ready to [create a deployment](https://vercel.com/docs/api#endpoints/deployments/create-a-new-deployment) with the Vercel API.

```bash
curl --location --request POST 'https://api.vercel.com/v12/now/deployments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer `mytoken` \
--data-raw '{
    "name": "my-instant-deployment",
    "files": [
        {
            "file": "vercel.json",
            "sha": "`SHA`",
            "size": `filesizeinbytes`
        }
    ],
    "projectSettings": {
        "framework": null
    }
}'
```

If you uploaded multiple files, each with a different `SHA`, append the `files` array in the above `POST` request with an object for each file.

## Deploying a project with multiple files

In most cases, your project will contain many files and folders. You can write a script using the language of your choice (such as `bash` or `node`) and the pattern described above to upload your project files, obtain the `SHA` values, and then deploy your project using the `SHA`, file size, and filename values for each file.