Issues
Upload an attachment
Upload an image to show in an issue's or a pull request's description or in a comment: a screenshot of a preview, say, instead of committing it to the repository. data is the file base64-encoded, name its file name (the image's alt text), content_type optional (checked against the bytes).
/repos/{owner}/{name}/attachmentsPNG, JPEG, GIF and WebP of at most 10 MB; a larger file is refused with 413 too_large, another type (SVG, PDF, anything its bytes do not show to be one of those) with 415 unsupported_type. Anyone who may comment on the repository may. Returns its id, url (on the usercontent origin, g1tusercontent.com on g1t.sh), name, size, content_type, and markdown () to paste into the body or summary of create_issue, update_issue, add_comment, create_pull_request or mark_pull_request_ready. Its address is its permission: anyone given it can see the image, even one from a private repository. Over MCP the file travels in the tool call, so keep it small (a few hundred KB); g1t attach FILE uploads one from disk and prints the markdown.
data is the file base64-encoded: base64 -w0 preview.png. Paste markdown into the body of an issue, pull request or comment, or a pull request’s summary. The type is read from the bytes; a file over 10 MB is refused with 413 (too_large), one that is not a PNG, JPEG, GIF or WebP with 415 (unsupported_type). From a shell, g1t attach preview.png does all of it and prints the markdown.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
issuewithactionattach, and the same inputs - Scope: An access token needs
issues:write.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
owner |
string | Yes | The workspace that owns the repository. |
name |
string | Yes | The repository’s name. |
Body parameters
Section titled “Body parameters”Send a JSON object. Names are snake_case, as in responses; the camelCase spelling is accepted too.
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | The file’s name, such as preview.png: the image’s alt text in the markdown. |
content_type |
string | No | What the file is. Optional: it is read from the bytes, and refused when it says otherwise. One of image/png, image/jpeg, image/gif, image/webp. |
data |
string | Yes | The file, base64-encoded: PNG, JPEG, GIF or WebP of at most 10 MB. |
Example request
Section titled “Example request”curl -X POST https://api.g1t.sh/repos/flagon-io/session-lab/attachments \ -H "Authorization: Bearer $G1T_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "preview.png", "content_type": "image/png", "data": "iVBORw0KGgoAAAANSUhEUgAA…" }'Example response
Section titled “Example response”A successful request answers 200 with:
{ "id": "3f9c2a7e5b1d48c6a0e7f4b2d9c81a6e5f3b7d2c9a4e8f1b6c0d5a7e2f9b3c41", "name": "preview.png", "url": "https://g1tusercontent.com/attachments/3f9c2a7e5b1d48c6a0e7f4b2d9c81a6e5f3b7d2c9a4e8f1b6c0d5a7e2f9b3c41", "markdown": "", "content_type": "image/png", "size": 184213}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | not_found |
It does not exist, or you cannot see it. |
| 409 | conflict |
The request conflicts with the current state. |
| 422 | invalid |
The input is not valid. message says which field and why. |