Check file
POST /v1/organisations/{organisation_id}/spaces/{space_id}/file-checks
Checks a file of a kind Ivy reads as configuration (a flow, connections.ivy.yaml, a space app manifest) as Ivy does, without saving anything: a version of a file, or draft text. The Files view, the agents' tools and saves by agents report the same problems.
Authentication
Send an API key, or an access token from your organisation’s identity provider, in the Authorization header. How API keys work
Scope the API key needs: files:read
Security schemes in the OpenAPI document: session_cookie (cookie __Host-ivy_session)bearer (bearer)api_key (bearer)
Parameters
-
organisation_idpathstringrequired -
space_idpathstringrequired
Request body
application/json CheckFile required
-
contentstring|nullDraft text, instead of
file_id; needskindorpath. -
file_idstring|nullChecks the file's readable version, or
version_id. -
kindFileKind|null -
pathstring|nullWhere the draft would be saved, such as
notes/notes.ivy-app.toml: decides the kind whenkindis absent, and an app manifest's id. -
version_idstring|null
Responses
-
The problems Ivy finds in the file as it reads its kind;
validwhen none is an error -
unauthenticated -
workspace_content_restricted,insufficient_scope -
No such file or version in this space
-
file_scanning,file_quarantined,file_scan_failed -
not_checkable: Ivy has no check for the file's kind;file_too_large,invalid_encoding,validation_failed -
rate_limited: the API key's requests per minute are used up; retry afterRetry-Afterseconds -
internal -
storage_unavailable; orunavailable: the database is briefly unavailable; retry afterRetry-Afterseconds
Error codes
Errors come back as an ErrorBody whose code is one of these.
- 401
unauthenticated - 403
workspace_content_restrictedinsufficient_scope - 404
not_foundgeneric code for this status - 409
file_scanningfile_quarantinedfile_scan_failed - 422
not_checkablefile_too_largeinvalid_encodingvalidation_failed - 429
rate_limited - 500
internal - 503
storage_unavailableunavailable
Examples
curl -X POST "$IVY_API_URL/v1/organisations/$ORGANISATION_ID/spaces/$SPACE_ID/file-checks" \
-H "Authorization: Bearer $IVY_API_KEY" \
-H "Content-Type: application/json" \
-d '{}' import { client, checkFile } from "@spacivapp/ivy-sdk";
client.setConfig({
baseUrl: process.env.IVY_API_URL,
headers: { Authorization: `Bearer ${process.env.IVY_API_KEY}` },
});
const { data, error, response } = await checkFile({
path: { organisation_id: organisationId, space_id: spaceId },
body: {},
}); {
"content": "string",
"file_id": "file_123",
"kind": "workflow",
"path": "string",
"version_id": "version_123"
} {
"file_id": "file_123",
"kind": "workflow",
"path_changes": [
"string"
],
"problems": [
{
"code": "not_found",
"column": 0,
"hint": "string",
"line": 0,
"message": "A short explanation for people",
"path": "string",
"reference": {
"page": "string",
"section": "string"
},
"severity": "error"
}
],
"reference": {
"page": "string",
"section": "string"
},
"valid": false,
"version_id": "version_123"
}