An artifact is what the API calls a document, such as a PDF, a sheet, or a chart that a task made. In the app, you can find them under Skills, Documents. These endpoints let you fetch a finished document, save an edited version, or file it in a client’s Space. To read artifacts, your key needs the Artifacts area, which is included in Full access and Read-only. To make changes, you need Full access or Artifacts set to Read and write. See Skills, tools and templates for more.
GET /artifacts lists your documents, and GET /artifacts/{id} returns a single document along with its current_version and versions list. Each version has its own id, which you need to pass whenever you make a change:
curl -X POST https://app.svanja.com/api/v1/artifacts/ARTIFACT_ID/actions \
-H "Authorization: Bearer $SVANJA_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"action":"save_to_space","version_id":"VERSION_ID","space_id":"SPACE_ID"}'
You can also run restore, save_source, save_csv, create_chart, save_chart, and attach. If you attach a document to an email draft, someone still has to approve it in the app (see The REST API). If you prefer working from a terminal, see svanja artifact and svanja publish.