---
title: "Get upload links for large files"
method: POST
path: "/sites/uploads"
tags: ["Sites"]
---

# Get upload links for large files

`POST /sites/uploads`

## Request

- Base URL: `https://api.hypamoon.com/api/v1`
- URL: `https://api.hypamoon.com/api/v1/sites/uploads`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://app.hypamoon.com/oauth/authorize`, token URL `https://api.hypamoon.com/oauth/token`, scopes: `sites:write`)

For files too large to send inline (one request to the API stays under 4 MB). Send path, sha256 and bytes for each file; the response contains an upload_url for each file. PUT the exact bytes to it within 15 minutes (curl -T file '<upload_url>'); the upload checks size, SHA-256 and the type of the bytes (422 type_mismatch) and stores the file. Video and audio above the inline limit (paid plans: up to the bytes_per_media limit) can only be uploaded this way. Then deploy with POST /sites or PUT /sites/{id}, naming the file with path, sha256 and bytes instead of content. A file another site of this project already has needs no new upload. The size is checked against the limits of the project's plan. Free: at most 200 files, 5 MB per file (a PDF 10 MB, video or audio 10 MB) and 50 MB together; with a paid plan or credit 2,000 files, 25 MB per file (a PDF 25 MB, video or audio up to 90 MB via create_upload_urls) and 1 GB together.

## Request body

- SiteUploadInput: Ask for upload links for files that are too large to send inline.
  - `site_id` string, uuid: Optional. The site the files are for, when you change an existing one (from deploy_site or list_sites). Leave it out for a new site.
  - `files` object[], required: The files to upload, at most 200 per request.
    - `path` string, required: Where the file will live on the site, like /img/hero.jpg.
    - `sha256` string, required: The SHA-256 of the file's bytes, as 64 lowercase hex characters (sha256sum, shasum -a 256).
    - `bytes` integer, required: The exact size of the file in bytes.
    - `content_type` string: Leave it out: it follows from the extension. Only for a path without a known extension, and only an allowed type.

## Response `201`

The upload links.

- SiteUploadList: Upload links for large files.
  - `data` object[], required: One upload link per file, in the order you sent them.
    - `path` string, required: The path, normalized (with a leading /).
    - `sha256` string, required: The SHA-256 you sent, lowercase.
    - `bytes` integer, required: The size you sent.
    - `content_type` string, required: The type the file will be served with.
    - `upload_url` string, required: PUT the exact bytes of the file here (any Content-Type), within expires_at. Using it again with the same bytes changes nothing.
    - `method` 'PUT', required: Always PUT.
    - `expires_at` string, required: When the link stops working (15 minutes).
  - `hint` string, required: What to do when the PUT to upload_url fails from your environment (a sandbox may block it).
  - `limits` object, required: The site limits of this project's plan.
    - `files` integer, required: Files per site for this project.
    - `bytes_per_file` integer, required: Bytes per file for this project.
    - `bytes_per_site` integer, required: Bytes per site for this project, all files together.
    - `bytes_per_pdf` integer, required: Bytes per PDF for this project.
    - `bytes_per_media` integer, required: Bytes per video or audio file (mp4, webm, mp3, m4a) for this project, when uploaded with an upload link.

## Other responses

- `400`: Bad Request: invalid_json.
- `401`: Unauthorized: unauthorized, missing_api_key, invalid_api_key, api_key_revoked, project_deleted.
- `403`: Forbidden: project_not_enabled, key_mode_mismatch, missing_scope, verification_required, site_offline.
- `404`: Not Found: not_found.
- `422`: Unprocessable Content: validation_failed, site_too_large.
- `429`: Too Many Requests: rate_limited.
- `500`: Internal Server Error: internal_error.
- `503`: Service Unavailable: service_unavailable.

---

[API](https://skmtc.dev/hypamoon/apis/hypamoon-api.md) · [All operations](https://skmtc.dev/hypamoon/apis/hypamoon-api/llms.txt) · [OpenAPI document](https://skmtc.dev/hypamoon/apis/hypamoon-api/revisions/9f0b90004c06?raw)
