File uploads

Create, inspect, update, delete, and download repo-scoped file uploads.

Endpoints

GET /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads
GET /api/v1/users/{username}/repos/{repo_slug}/uploads

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

GET /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads/{upload_uuid}
GET /api/v1/users/{username}/repos/{repo_slug}/uploads/{upload_uuid}

PUT /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads/{upload_uuid}
PUT /api/v1/users/{username}/repos/{repo_slug}/uploads/{upload_uuid}

DELETE /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads/{upload_uuid}
DELETE /api/v1/users/{username}/repos/{repo_slug}/uploads/{upload_uuid}

GET /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads/{upload_uuid}/content/{filename}
GET /api/v1/users/{username}/repos/{repo_slug}/uploads/{upload_uuid}/content/{filename}
Authenticated Repo scoped

Download URLs include the original filename as the final path segment, for example /api/v1/teams/{team_slug}/repos/{repo_slug}/uploads/{upload_uuid}/content/openapi.json.

Create payload

Uploads are sent as multipart/form-data with these fields:

  • 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

The server stores uploads under repo and file UUID buckets and derives the file extension itself.

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"

Errors

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