Skills
Restore a skill revision
Restore an earlier revision’s content as a new revision.
POST
/
api
/
v2
/
skills
/
{name}
/
revisions
/
{number}
/
restore
from hai_agents import Client
client = Client()
skill = client.skills.restore_skill_revision(name="extract-table-data", number=1, if_match='"3"')
print(skill.body)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const skill = await client.skills.restoreSkillRevision({ name: "extract-table-data", number: 1, ifMatch: '"3"' });
console.log(skill.body);
curl -X POST https://agp.eu.hcompany.ai/api/v2/skills/extract-table-data/revisions/1/restore \
-H "Authorization: Bearer $HAI_API_KEY" \
-H 'If-Match: "3"'
{
"name": "extract-table-data",
"description": "Use when the task asks for data in an HTML table.",
"body": "When you encounter an HTML table...",
"source": "https://github.com/myorg/skills",
"url_pattern": null,
"compatibility": null,
"files": {},
"executable_files": []
}
History is never rewritten: the content of revision
Plus the common errors.
number becomes the skill’s next revision, with the message Restored from vN and restored_from set to N. Agents use it from their next session, except those pinned to another revision with name:N. Restoring content equal to the current one changes nothing.
The restored content is checked like an update.
Headers
The
ETag you read, for example "3". A stale value fails with 412. Omit it, or send *, to skip the check. See Revisions and concurrency.Path parameters
The revision to restore, from List revisions.
Response
200 with the restored skill object, with its new revision in the ETag header.
from hai_agents import Client
client = Client()
skill = client.skills.restore_skill_revision(name="extract-table-data", number=1, if_match='"3"')
print(skill.body)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const skill = await client.skills.restoreSkillRevision({ name: "extract-table-data", number: 1, ifMatch: '"3"' });
console.log(skill.body);
curl -X POST https://agp.eu.hcompany.ai/api/v2/skills/extract-table-data/revisions/1/restore \
-H "Authorization: Bearer $HAI_API_KEY" \
-H 'If-Match: "3"'
{
"name": "extract-table-data",
"description": "Use when the task asks for data in an HTML table.",
"body": "When you encounter an HTML table...",
"source": "https://github.com/myorg/skills",
"url_pattern": null,
"compatibility": null,
"files": {},
"executable_files": []
}
Errors
| Status | Cause |
|---|---|
400 | The path carries a name:N pin, or If-Match is not a single revision tag. |
403 | The skill is reserved (h/) and read-only. |
404 | Not found, or not in your organization. Also sent for an unknown revision. |
410 | The revision’s stored content fails current validation. |
412 | If-Match names a stale revision. The ETag header has the current one (Revisions and concurrency). |
Was this page helpful?
⌘I
from hai_agents import Client
client = Client()
skill = client.skills.restore_skill_revision(name="extract-table-data", number=1, if_match='"3"')
print(skill.body)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
const skill = await client.skills.restoreSkillRevision({ name: "extract-table-data", number: 1, ifMatch: '"3"' });
console.log(skill.body);
curl -X POST https://agp.eu.hcompany.ai/api/v2/skills/extract-table-data/revisions/1/restore \
-H "Authorization: Bearer $HAI_API_KEY" \
-H 'If-Match: "3"'
{
"name": "extract-table-data",
"description": "Use when the task asks for data in an HTML table.",
"body": "When you encounter an HTML table...",
"source": "https://github.com/myorg/skills",
"url_pattern": null,
"compatibility": null,
"files": {},
"executable_files": []
}