Rounds & Reps developer guide

Pivot website agent API

Edit the Pivot Fitness Hoover website, preview changes, and publish the reviewed result. This guide is public; the API requires Pivot's private site key.

Connect

API base URL: https://api.roundsandreps.com/v1

Send Authorization: Bearer <site key> with every request. Obtain the key privately from your Rounds & Reps contact. Never put it in source code, a public issue, or a URL.

The key is scoped to Pivot. File paths are relative to clients/pivot-fitness-hoover/; other client sites and platform files cannot be edited through this API.

Endpoints

MethodPathPurpose
GET/siteSite URLs, current main SHA, preview and live release status
GET/filesList editable site files
GET/files?path=src/App.jsx&ref=mainRead a file as base64; ref may be a change ID
POST/changesCommit files to an agent branch and open a PR
GET/changes/{id}Check PR head and preview status
PATCH/changes/{id}Revise an open change
POST/changes/{id}/refreshBring an open change up to date with main
POST/changes/{id}/previewDeploy the green, exact-head build to staging
POST/changes/{id}/publishPromote the completed preview artifact to production
POST/rollbackRestore the previous deployed artifact

Paths above are appended to the /v1 base URL.

Create and preview a change

  1. Call GET /site and save main_sha. Use GET /files to inspect the site and read complete files before editing.
  2. Send POST /changes with that SHA, a message, and complete replacement files encoded as base64. A file deletion uses {"path":"old-file.txt","delete":true}.
  3. Wait for the change's exact-head build to pass, then call POST /changes/{id}/preview. Inspect the returned preview URL in a browser and wait for GET /site → releases.preview.cdn_status to equal Completed.
  4. Once the preview is accepted, call POST /changes/{id}/publish. Wait for releases.live.cdn_status to equal Completed, then check the live site.

Publish requires the same change head that was previewed and a current, clean main branch. If main advanced, call POST /changes/{id}/refresh and preview again. If only the change head advanced, preview its new head.

{
  "base_sha": "<main_sha from GET /site>",
  "message": "Update homepage headline",
  "files": [
    {"path": "src/App.jsx", "content_base64": "<base64 of complete file>"}
  ]
}

Limits and rollback

Each revision supports up to 25 files, 6 MB per file, and 7 MB per request. One Pivot change may be open at a time so the preview URL remains unambiguous. Revisions use PATCH /changes/{id} with files, message, and expected_sha from GET /changes/{id}.

POST /rollback restores the previous deployed artifact; it does not revert Git history. Inspect the current release with GET /site before and after rollback.