curl --request POST \
--url https://api.goyappr.com/agents/{id}/workflow/publish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 4503599627370496
}
'import requests
url = "https://api.goyappr.com/agents/{id}/workflow/publish"
payload = { "expected_version": 4503599627370496 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_version: 4503599627370496})
};
fetch('https://api.goyappr.com/agents/{id}/workflow/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/agents/{id}/workflow/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expected_version' => 4503599627370496
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/agents/{id}/workflow/publish"
payload := strings.NewReader("{\n \"expected_version\": 4503599627370496\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/agents/{id}/workflow/publish")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 4503599627370496\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/agents/{id}/workflow/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_version\": 4503599627370496\n}"
response = http.request(request)
puts response.read_body{
"revision": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 2,
"content_hash": "<string>",
"published_at": "2023-11-07T05:31:56Z",
"environment": "local"
},
"execution_version": "workflow_v1",
"settings_updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"path": "<string>",
"message": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
],
"warnings": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"path": "<string>",
"message": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
],
"warnings": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}Publish workflow
Compile and publish an immutable workflow version explicitly.
curl --request POST \
--url https://api.goyappr.com/agents/{id}/workflow/publish \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expected_version": 4503599627370496
}
'import requests
url = "https://api.goyappr.com/agents/{id}/workflow/publish"
payload = { "expected_version": 4503599627370496 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expected_version: 4503599627370496})
};
fetch('https://api.goyappr.com/agents/{id}/workflow/publish', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.goyappr.com/agents/{id}/workflow/publish",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expected_version' => 4503599627370496
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.goyappr.com/agents/{id}/workflow/publish"
payload := strings.NewReader("{\n \"expected_version\": 4503599627370496\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.goyappr.com/agents/{id}/workflow/publish")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 4503599627370496\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goyappr.com/agents/{id}/workflow/publish")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_version\": 4503599627370496\n}"
response = http.request(request)
puts response.read_body{
"revision": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"version": 2,
"content_hash": "<string>",
"published_at": "2023-11-07T05:31:56Z",
"environment": "local"
},
"execution_version": "workflow_v1",
"settings_updated_at": "2023-11-07T05:31:56Z"
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"path": "<string>",
"message": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
],
"warnings": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"path": "<string>",
"message": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
],
"warnings": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>",
"node_id": "<string>",
"label": "<string>",
"tool_name": "<string>",
"field": "<string>"
}
]
}{
"error": "<string>",
"code": "<string>",
"issues": [
{
"code": "<string>",
"message": "<string>",
"path": "<string>"
}
]
}agents:update. Publication is separate from draft saving and checking.
400 WORKFLOW_REQUEST_INVALID with issues[0].path /expected_version; a draft naming a tool revision this workspace cannot use is 422 WORKFLOW_REFERENCE_INVALID with one issue per binding — see Save workflow draft.curl -X POST 'https://api.goyappr.com/agents/AGENT_ID/workflow/publish' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'x-company-id: COMPANY_ID' \
-H 'Content-Type: application/json' \
-d '{"expected_version":5}'
expected_version counts saved drafts; revision.version
counts publications. They are different numbers: publishing drafts 2, 3 and 5
makes versions 1, 2 and 3, so the request above answers "version": 3. The
dashboard’s Live · version 3 and the toast Version 3 is live. are
revision.version.
201 returns revision (id, version, content_hash, published_at,
environment), read-only execution_version: "workflow_v1", and
settings_updated_at. Matching publication replay returns the same revision; it
does not create another version blindly. A replay also changes nothing on the
agent, so it answers with the same settings_updated_at the first response
carried — retrying a publish whose response was lost never invalidates the token
you already hold.
The revision this returns is immediately the one new calls run. environment is
the deployment plane that stored it — you do not choose it, and on the hosted
API it is testing, which is that deployment’s own configuration rather than
anything about your agent. Calls placed through this same API run on that same
plane, so the version you just published is the version your next call runs. See
What environment says
for the one case where the two can come apart.
The dashboard never shows the testing value. It labels the same version
Live — the publish toast reads Version 3 is live. and the agent’s header
shows Live · version 3 — because that is what it means for your callers, and
GET /agents/{id} answers
live: true.
environment: "testing" here and Live on screen are one version on one plane,
not two stages; there is nothing to promote.
Publishing moves the settings token
Publication records which version the agent now runs, which writes the agent row — the same row Agent settings andPATCH /agents/{id} compare expected_updated_at
against. So an updated_at read before publishing is stale the moment the
publish succeeds, and a PATCH sent with it answers 409 WORKFLOW_SETTINGS_CONFLICT even though nobody else touched the agent.
settings_updated_at on this response is that new token. Send it as
expected_updated_at on the next PATCH and the documented sequence — create,
save, check, publish, then change a setting — completes without a re-read:
{
"revision": { "id": "…", "version": 3, "content_hash": "…", "published_at": "…" },
"execution_version": "workflow_v1",
"settings_updated_at": "2026-09-21T07:14:03.120451+00:00"
}
updated_at before your next save.
The server compiles and atomically rechecks the draft, account epochs, tool
revisions and effective settings. 409 means one changed; reread and reconcile.
422 blocks an invalid graph/schema or unavailable reference. 413 indicates a
document/settings size budget; 503 indicates compiler/storage unavailability.
None authorizes a fallback publication through the legacy flow API.
Strict-mode changes take effect only upon publication for future accepted
calls. Existing accepted runs keep frozen artifacts. Publishing a disabled
agent does not reactivate it; publishing never starts a call or makes an
unready media test available.
Everything Check workflow checks is checked
again here, and the same issues[] codes come back on 422 — sequence
branching, the Before and After phase rules, and every {{before.…}} reference
written into step instructions. Nothing is published while one stands. An issue
about one step — or about a binding a step runs — also carries that step’s
node_id and label, as Check workflow shows.
One of those refusals is about the Before phase in particular, and it is resolved
by changing the document rather than by retrying: before_budget_exceeded, when
the chain of before-call steps cannot finish inside the platform’s preparation
window. See
Before-call steps, the channel and the window.
A required tool input whose only source is saved context (kind: "stored",
no fallback) is refused here too, with stored_context_has_no_writer:
nothing writes saved context, so the step would run without that input on
every call. So is a required input reading a call-request field
request_schema does not declare, with no fallback (missing_request_field,
see Check workflow).
The draft stays saved. Every 422 carries warnings[] beside issues[]:
strict_off_guidance when strict mode is off, and every advisory about a
binding or an input. The compiler’s own graph advisories arrive once the
document compiles — see Check workflow.
On every issue label is the step’s label; a binding issue names the tool in
tool_name and the input in field.
A tool wired into a phase its contract excludes is refused here:
422 WORKFLOW_VALIDATION_FAILED with binding_phase_unsupported, naming the
step. A transfer in a before-call or after-call step cannot run in any
configuration of any agent, so publishing it would put a step live that does
nothing. See Check workflow. A tool that
cannot run on every channel the agent answers on is an advisory, not a refusal
— the same page says why.
An advisory is not an issue and never blocks publication. The codes Check
returns as warnings[] — strict_off_guidance, during_output_advisory,
sequence_branch_advisory, before_reference_missing_fallback, override_needs_strict,
after_ending_coverage, after_any_end_waits, before_budget_inbound and
binding_channel_unsupported — describe a document that compiles and publishes
as written. Publishing a {{before.…}}
reference with no fallback text, whose producing step may not run, is allowed:
if the value is missing when the call starts, the reference is removed and the
agent speaks the sentence without it. Add fallback text after the | in that
reference if that is not what you want. Publication returns the revision only —
run Check workflow to read the advisories.
Publishing does not change how a version already accepted for a call behaves —
routes, conditions, refusal routes and before-call references are frozen into the
published artifact alongside everything else.Authorizations
Your Yappr API key (e.g. ypr_live_...). Generate one in the dashboard under Settings → API Keys. No key is 401 MISSING_KEY; a key that is not one of ours, or is revoked, is 401 INVALID_KEY; an expired one is 401 EXPIRED_KEY. A valid key without the scope an operation needs is 403 INSUFFICIENT_SCOPE on every operation, and the message names the scope. Every response, a 401 included, carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset: the budget is 60 requests a minute per API key. Every 429, whatever its code, carries Retry-After (whole seconds, never zero): the per-key budget's RATE_LIMIT asks for what is left of the minute, a route's daily cap (RATE_LIMITED) for the time until that cap resets. All four headers are listed in Access-Control-Expose-Headers, so a browser can read them. A path the API does not serve (an unknown sub-path, an id left empty) is 404 ROUTE_NOT_FOUND, and a method a served path does not take is 405 METHOD_NOT_ALLOWED with an Allow header; both are answered before any scope check, and nothing is read or changed. A trailing slash is ignored where it cannot be an id left empty (POST /calls/ is POST /calls) and refused where it can (GET /calls/). A doubled slash inside a path is merged into one before the request reaches the API (GET //calls is GET /calls).
Headers
Response
Immutable published version, or its matching existing publication.
The agent settings token as of this publication. Publishing records which version the agent runs, which writes the agent row, so an updated_at read before publishing is stale afterwards and PATCH /agents/{id} would answer 409 WORKFLOW_SETTINGS_CONFLICT. Replaying an identical publish changes nothing and returns the same value. Send this value as expected_updated_at on the next settings save. Absent only when the timestamp could not be read; the publication itself is unaffected, so re-read GET /agents/{id}/settings.