# Publish with curl

Publish a release from your terminal with curl and jq, no coding agent needed.

Everything a coding agent does on releaseszn goes through a public REST
API, so you can do it yourself from a terminal. This guide publishes
`v1.2.0` of `alice/ripfast` in seven requests. It takes a few minutes, with
the same checks as [the website](/docs/quickstart#publish-from-the-website)
and [an agent](/docs/quickstart#1-run-the-prompt).

You need:

- A public GitHub repository you can **admin** or **maintain**, and a
  version tag for the release (for example `v1.2.0`); a GitHub release
  isn't required
- A screenshot of your software, at least **1200×630** pixels
  ([Release requirements](/docs/release-requirements))
- `curl`, and [`jq`](https://jqlang.org) to read the answers and build
  the JSON

## 1. Get a token

[Sign in](/login) with GitHub, open [API tokens](/settings/tokens) and
create a token with the `submit` scope. It starts with `rsz_` and is shown
only once. Save it in a file only you can read; this asks for it without
showing it:

```bash
mkdir -p ~/.config/releaseszn && (umask 077 && read -rs -p 'releaseszn token: ' token && echo && printf 'Authorization: Bearer %s\n' "$token" > ~/.config/releaseszn/auth-header)
```

The file holds the whole header, and `curl -H @file` sends it, so the token
never shows in your shell's history or in `ps`. Set two shortcuts for the
commands below, and check the token:

```bash
API=https://releaseszn.com/api/v1
AUTH=@$HOME/.config/releaseszn/auth-header

curl -sS "$API/me" -H "$AUTH" | jq '{handle: .user.handle, scopes: .token.scopes}'
```

## 2. Pick the tags

Every project has exactly one AI-usage tag (`ai/none`, `ai/assisted` or
`ai/generated`: how much of the code AI wrote; it's disclosure, not a
penalty), up to 3 categories (`cat/…`) and up to 5 platforms
(`platform/…`). The language and the license are detected from the
repository. To list the ones you can set:

```bash
curl -sS "$API/tags" | jq -r '.tags[] | select(.settable) | .tag'
```

## 3. Create the project

```bash
curl -sS -X POST "$API/projects" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"repo_url": "https://github.com/alice/ripfast",
       "summary": "A grep that is fast on huge monorepos",
       "tags": ["cat/cli", "platform/linux", "ai/assisted"]}' | jq '{slug, import_status}'
```

The answer's `slug` names the project in every later request (here
`ripfast`). Sending the same request again is safe: it answers with the
project you already have. The project and its releases are imported from
GitHub in a few seconds; wait until `import_status` is `done`:

```bash
until [ "$(curl -sS "$API/projects/ripfast" | jq -r .import_status)" = done ]; do sleep 2; done
```

If it reads `failed`, `import_error` says why.

## 4. Find the release

Your releases arrive as drafts:

```bash
curl -sS "$API/projects/ripfast/releases?status=draft" -H "$AUTH" \
  | jq '.releases[] | {tag, kind, title}'
```

`kind` is `initial`, `major`, `minor`, `patch` or `other`. Patch releases
reach the project's followers but aren't ranked: see
[Ranking](/docs/ranking) before tagging a new release just for that.

## 5. Write the changelog

The changelog starts as your GitHub release notes. Say what changed and
why it matters to the people who use it: a changelog that is empty or only
says "bump" isn't ranked. Write it in a file, in Markdown, and let `jq`
turn it into JSON, so quotes and line breaks need no escaping:

```bash
jq -n --rawfile changelog CHANGES-1.2.0.md \
  '{title: "Parallel directory walker", changelog: $changelog}' \
  | curl -sS -X PATCH "$API/projects/ripfast/releases/v1.2.0" -H "$AUTH" \
      -H "Content-Type: application/json" -d @- | jq '{tag, title}'
```

`title` is optional: a few words that headline the release.

## 6. Add the screenshot

Upload it from your computer, with a sentence saying what it shows (what
screen readers say, and what people see if the image doesn't load):

```bash
curl -sS -X POST "$API/projects/ripfast/media" -H "$AUTH" \
  -F release_tag=v1.2.0 -F role=hero \
  -F 'alt_text=ripfast results for TODO across the Linux kernel, grouped by file' \
  -F file=@screenshot.png | jq '{id, status}'
```

It's checked in a few seconds. Poll it with the `id` from the answer, then
read the result:

```bash
ID=110
until curl -sS "$API/media/$ID" -H "$AUTH" | jq -e '.status | IN("ready", "failed")' >/dev/null; do sleep 2; done
curl -sS "$API/media/$ID" -H "$AUTH" \
  | jq '{status, hero_ok, error, fixes: [.quality.checks[]? | select(.ok | not) | .fix]}'
```

`hero_ok: true` means it passed. Otherwise each check that failed says
what to change in `fixes` (crop the empty borders, take it at full size…):
upload another image the same way. A file that can't be used at all ends
`failed`, with the reason in `error`. Files up to 10 MB go in one request;
a larger one (a long GIF) takes a
[presigned upload](/docs/api-endpoints#media). An image already online can
be imported by its address instead: send `source_url` as JSON in place of
the file.

## 7. Check, then publish

`check` runs every rule without changing anything:

```bash
curl -sS -X POST "$API/projects/ripfast/releases/v1.2.0/check" -H "$AUTH" \
  | jq '{publishable, eligible, failing: [.gates[] | select(.ok | not) | {gate, fix}]}'
```

`publishable` means it can be published; `eligible` that it will also be
ranked. Each rule that isn't met has a `fix`. Some need nothing from you,
such as a patch release, which is published but not ranked. When
`publishable` is `true`:

```bash
curl -sS -X POST "$API/projects/ripfast/releases/v1.2.0/publish" -H "$AUTH" \
  | jq 'if .release then {status: .release.status, eligible: .release.eligible, url: .release.url} else {code, fix} end'
```

The answer has the release's address, for example
`https://releaseszn.com/p/ripfast/v1.2.0`. It's in the feed at once, and
if it's eligible it competes for Release of the Day, Week and Month.

For 24 hours after publishing, step 5 still changes the changelog and the
title, and more media can be added (`role` `carousel` or `gallery`).

## Your next release

Tag it on GitHub, then ask releaseszn to read the repository again, wait
for the import as in step 3, and repeat steps 4 to 7 with the new tag:

```bash
curl -sS -X POST "$API/projects/ripfast/sync" -H "$AUTH" | jq .next
```

## When a request fails

Every error is JSON with a `code` and a `fix` sentence for that exact
request, and invalid input lists every field at once:

```bash
curl -sS "$API/projects/ripfast" -X PATCH -H "$AUTH" \
  -H "Content-Type: application/json" -d '{"tags": ["cat/cli"]}' | jq '{code, fix, errors}'
```

[Errors](/docs/errors) lists every code. A request that times out can be
sent again safely with an `Idempotency-Key` header (any unique string, such
as `$(uuidgen)`): the server answers a repeat with the first answer
instead of doing it twice ([Idempotency](/docs/api#idempotency)).

## Next steps

<div class="doc-cards">
<a class="doc-card" href="/docs/api-endpoints"><strong>Endpoints</strong><span>Every request and field, including the presigned upload.</span></a>
<a class="doc-card" href="/docs/release-requirements"><strong>Release requirements</strong><span>The screenshot checks and how to pass them.</span></a>
</div>
