Create file upload

Upload a file into a repo as multipart form data.

Endpoints

POST /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads
POST /api/v1/users/{username}/repos/{repo_slug}/uploads
Authenticated Repo scoped

Request

  • file (required): the binary file part
  • description (optional): free-form description text
  • content_type (optional): declared content type; the server normalizes it with magic-byte sniffing

Example

curl --request POST \
  --header "Authorization: Bearer $GHIT_API_TOKEN" \
  --form "file=@./screenshot.png" \
  --form "description=Build screenshot" \
  "$GHIT_API_URL/v1/teams/platform/repos/website/uploads"

Response

Returns `201 Created` with the created upload metadata.

Errors

  • 400 Bad Request for malformed multipart payloads or invalid upload size.
  • 403 Forbidden when the caller cannot manage uploads in the repo.
  • 404 Not Found when the repo does not exist.