Skip to content

Get Code2WF Result

Method

This planned API returns the complete validated immutable Code2WF worker result. The result contains the existing WF2Des DesignSpecModel that the Figma plugin materializes.

HTTP Method

GET: Retrieve a completed Code2WF result

Naming Convention

This data-plane response uses snake_case and preserves the immutable worker result without renaming, dropping, or projecting fields.

Request and Response

Headers

Meta information is set in HTTP headers, not in the response body.

Request Headers

  • Authorization
  • Content-Type
  • Accept
  • Accept-language

Response Headers

  • Content-Type

Get Code2WF Result

URI

GET /api/v1/organizations/{organization_id}/projects/{project_id}/code2wf/{code2wf_id}/result

Path Parameters

Name Type Required Description
organization_id integer Required Organization ID
project_id integer Required Project ID
code2wf_id string Required Code2WF UUID

Request Body

None.

Response

{
  "job_id": "019ffa90-7900-75a3-8123-456789abcdf1",
  "attempt": 1,
  "organization_id": 1,
  "project_id": 7,
  "screen_id": "AUTORACE_DATABASE",
  "status": "success",
  "generated_at": "2026-08-13T10:01:00Z",
  "inputs": {
    "page_import_id": "0195f16e-6f11-7ea8-b45c-f6712ed9d8a3",
    "page_result_url": "s3://bucket/1/7/page-import/0195f16e-6f11-7ea8-b45c-f6712ed9d8a3/normalized/manifest.json",
    "page_result_hash": "sha256:44a7f61a6f90f476c349b264c0cbd824ce45ecad0d9985f0750f8a251aa9592a",
    "capture_hash": "sha256:90e54d8b9cf4ff0fdc2b927b4453d59f4c3e219c236bb398e660aca50a62ae27"
  },
  "spec": {
    "spec_version": "1.0",
    "parse_confirmed": true,
    "style_bindings": {},
    "root": {
      "node": "layout_frame",
      "layer_path": "root",
      "auto_layout": {
        "direction": "vertical",
        "gap": 16.0,
        "padding": 24.0,
        "sizing": "fixed",
        "gaps": [],
        "primary_align": "",
        "counter_align": "",
        "wrap": "",
        "counter_gap": 0.0
      },
      "fill": "#ffffff",
      "corner_radius": 0.0,
      "bbox": { "x": 0.0, "y": 0.0, "w": 1440.0, "h": 1860.0 },
      "lineage_wf_node_ids": [],
      "children": []
    }
  }
}

Response Fields

Name Type Description
job_id string Code2WF row UUID from the immutable worker artifact.
attempt integer Always 1 in the MVP.
organization_id / project_id integer Tenant and project scope validated against the Code2WF row.
screen_id string Exact caller-confirmed screen ID stored on the Code2WF row.
status string Literal success for this completed result artifact.
generated_at string UTC ISO 8601 terminal-write time.
inputs object Exact immutable Page Import lineage pins used by the worker.
inputs.page_import_id string Page Import UUID matching the Code2WF row.
inputs.page_result_url string Canonical immutable normalized-manifest S3 URL used for generation.
inputs.page_result_hash / capture_hash string Exact normalized-manifest byte hash and rendered-evidence identity.
spec object Validated immutable existing WF2Des DesignSpecModel, directly consumable as the plugin AssemblySpec.

The complete contract and limits are defined in the Code2WF I/O Definition. The response body is the full validated worker artifact. The endpoint does not add a wrapper, rename job_id to code2wf_id, drop lineage fields, translate the spec, or add Code2WF-only node, asset, annotation, or warning collections.

The plugin consumes the returned artifact directly, retains its outer identity and lineage fields, and passes the nested spec to the current WF2Des planner/materializer. Planned plugin work adds Code2WF discovery, this endpoint call, placement reporting, plus completion of support in the shared builder/types for the already-defined text fallback, layout sizing/wrap, and nullable source fields used by canonical Pydantic output.

Reading a result does not create Figma nodes or change materialized_at.

Authentication

Authentication uses an Amazon Cognito JWT. The caller must have Read access to the project.

Error Handling

Description Status Code Status Name
Missing authentication credentials 401 Unauthorized
Job is unauthorized, unknown, not completed, or has no result 404 Not Found
Result schema, identity, or lineage validation fails 500 Internal Server Error

Processing Flow

  1. Authenticate and verify Read access.
  2. Fetch the scoped, non-deleted row and require status="1", attempt=1, and a client-facing result_url.
  3. Resolve row.result_url as the immutable client-facing result.json key, not a terminal-manifest key. Check S3 metadata first and reject a declared size above 10 MiB, then stream through a 10 MiB bounded reader that aborts if the actual bytes exceed the same limit; do not use an unbounded full-object buffer.
  4. Validate the WF2Des-aligned outer job_id, tenant, attempt, screen, status, and generated time against the row; validate Page Import identity and hashes from inputs; then validate the nested object with the existing WF2Des DesignSpecModel.
  5. Return the complete validated immutable worker artifact with its original job_id, attempt, tenant/project, screen, status, generated time, Page Import inputs, and nested spec; do not rename, drop, wrap, or project fields.

The backend does not compare Page Import hashes stored on the Code2WF row because no such columns exist; the immutable result artifact carries and validates the exact Page Import pins under inputs. The endpoint returns that full artifact, and the plugin materializes its nested existing spec. The terminal manifest is callback-only and is not read by this endpoint.