---
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"
last_updated: 2025-11-10
authors: Ismael Rumzan
related:
  - /docs/api
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

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:

`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:

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

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