Check a spec file and write its lock

Reads a sandbox spec file as the project would make it, and answers every problem with it and the lock Pod would write for it now.

POST/v1/specs:check

Reads a sandbox spec file as the project would make it, and answers every problem with it and the lock Pod would write for it now. Nothing is made, stored or billed. The file's own rules are checked first, as both SDKs check them before sending; then what only Pod knows: that the template, image or snapshot is one the project can see and its digest, that the cell and the plan offer the system, the size and each capability, and, once rules are enforced, that the policy compiler accepts the rules. With lock, it also says whether that lock was written for this file and whether its pins still exist. A problem is never an error answer: a file with problems answers 200 with ok false and no lock. An image built from a Dockerfile or a repository needs a lock that pins the image built; without one such a file has needs_build. Commit lock_text as pod.lock beside pod.yaml; writing it again with nothing changed writes the same bytes.

A key with the sandboxes:read scope.

Request

curl -X POST "https://api.pod.mapier.ai/v1/specs:check" \
  -H "Authorization: Bearer $POD_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"spec":"example"}'

Parameters

NameInTypeRequiredWhat it is
Idempotency-KeyheaderstringNoMakes a repeat of this call safe for 24 hours.

Body

FieldTypeRequiredWhat it is
projectstringNoThe project to check against, as on create. A key's own by default.
specstringYesThe spec file's text, YAML (pod.yaml).
lockstring | nullNoThe lock file's text (pod.lock), when the repository has one.

Answer

200. The problems, and the lock Pod would write.

200
{
  "ok": false,
  "spec_hash": null,
  "problems": [
    {
      "code": "yaml",
      "severity": "error",
      "path": "example",
      "message": "example",
      "line": 1
    }
  ],
  "lock_state": "missing",
  "lock": null,
  "lock_text": null
}
FieldTypeAlwaysWhat it is
okbooleanYesThe file has no error and can be made.
spec_hashstring | nullYesThe spec file's hash; null when it could not be read. Sandboxes made from it carry it in the pod.spec label.
problemsSpecProblem[]Yes
lock_state"missing" | "fresh" | "stale"YesWhether the lock sent was written for this file.
lockSpecLock | nullYesThe lock Pod would write for the file now; null when ok is false.
lock_textstring | nullYesThe lock's text, to commit as it is.

Errors

The refusals this call is known for: invalid, forbidden, in_other_cell. Any call can also answer unauthorized, rate_limited, unavailable or internal; the error list says what each means and when to send the call again.

In the SDKs

ClientCall
TypeScriptpod.specs.check(text, { lock })
Pythonpod.specs.check(text, lock=…)