Skip to content

Get Code2Des Result

Method

This API follows the same control-plane/data-plane separation as WF2Des and Code2WF.

HTTP Method

GET: Retrieve a completed Code2Des native-Figma artifact

Naming Convention

The response preserves the worker-owned snake_case artifact. For image nodes, the backend adds asset.data_base64 without renaming or removing the original artifact fields.

Request and Response

Headers

Request Headers

  • Authorization
  • Accept
  • Accept-language

Response Headers

  • Content-Type

Get Code2Des Result

URI

GET /api/v1/organizations/{organization_id}/projects/{project_id}/code2des/{code2des_id}/result

Path Parameters

Name Type Required Description
organization_id integer Required Organization ID
project_id integer Required Project ID
code2des_id string Required Code2Des UUID

Request Body

None.

Response

The response is JSON (HTTP status: 200 OK).

{
  "code2des_id": "019ffa75-01c0-75a2-8123-456789abcdf0",
  "page_import_id": "019ffa75-01c0-75a2-8123-456789abcdef",
  "status": "succeeded",
  "capture_hash": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
  "spec": {
    "spec_version": "1.0",
    "mode": "exact",
    "viewport": {
      "width": 1440,
      "height": 900,
      "device_scale_factor": 1
    },
    "source_url": "https://example.com/",
    "screenshot_url": "s3://bucket/1/7/page-import/page-id/screenshot.png",
    "screenshot_hash": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
    "font_faces": [],
    "root": {
      "node": "frame",
      "layer_path": "root",
      "name": "example.com",
      "bbox": { "x": 0, "y": 0, "w": 1440, "h": 900 },
      "opacity": 1,
      "absolute": true,
      "source_node_id": "root",
      "source_tag": "body",
      "fills": [],
      "border": null,
      "corner_radius": [0, 0, 0, 0],
      "effects": [],
      "clips_content": false,
      "blend_mode": "normal",
      "layout_hint": {
        "mode": "none",
        "gap": 0,
        "counter_gap": 0,
        "wrap": false,
        "padding": [0, 0, 0, 0],
        "primary_align": "MIN",
        "counter_align": "MIN"
      },
      "children": []
    },
    "warnings": []
  }
}

Response Fields

Name Type Description
code2des_id string Code2Des job that produced this artifact.
page_import_id string Source Page Import identity.
status string Successful artifacts always use "succeeded".
capture_hash string SHA-256 identity of the exact Page Import capture consumed by the worker.
spec object Deterministic native-Figma specification with viewport/source evidence, font evidence, a root node tree, and warnings.
spec.root object Root frame; descendants are frame, text, image, vector, or unmatched nodes.
image.asset.data_base64 string Image bytes injected by the backend for plugin materialization. Present on hydrated image nodes.

Why This Is Separate from Status

GET .../code2des/{code2des_id} reads only the small PostgreSQL lifecycle row and is safe to poll repeatedly. This result endpoint performs the more expensive data-plane work: it downloads resultUrl, parses and validates spec.root, validates every image asset against the exact tenant/Page Import prefix, downloads those image objects, and injects base64 bytes.

Keeping these reads separate prevents status polling from repeatedly downloading a potentially large artifact and its assets. This is not a second result source: the status response contains only resultUrl metadata, while this endpoint returns the result content.

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 missing, out of scope, soft-deleted, processing, failed, or has no result pointer 404 Not Found
Artifact is malformed or an image reference is outside the tenant-scoped Page Import asset prefix 500 Internal Server Error

Processing Flow

  1. Authenticate and verify Read access.
  2. Fetch the scoped, non-deleted Code2Des lifecycle row.
  3. Require status: "1" and a non-null resultUrl.
  4. Download and parse the immutable JSON artifact from S3.
  5. Require spec.root and hydrate tenant-scoped image nodes with asset.data_base64.
  6. Return the artifact without changing materialization state.

After the plugin creates the Figma root, it records that separate side effect through POST .../code2des/{code2des_id}/placement.