Yapper API
Api reference
POST
/sessions/{sessionId}/canvas/nodes

Adds 1-50 cards in one request, already wired. Give a card a ref and later cards in the same request can wire from it with inputs: [{ sourceRef }]; sourceNodeId wires from a card already on the canvas. A wire without port goes to the first free port that takes the source's type (text into prompt, images into references); wires are checked like a drag in the app: matching types, room in the port for the card's model, and no loops. Cards without a position are laid out left to right after the existing cards. Media cards take an assetId of their type and add that asset to the session. Generation cards default to the web app's default model and settings; modelId comes from GET /models for image-gen and video-gen and from textModels in GET /canvas for text-gen, and settings are checked against that model (video settings snap to the model's nearest supported values, as in the app). A field that does not apply to the card's kind is rejected. Shows up live on the canvas in the Yapper web app. Free. Uses the processes:write scope.

Authorization

bearerAuth processes:write
AuthorizationBearer <token>

In: header

Scope: processes:write

Path Parameters

sessionId*string

Header Parameters

Idempotency-Key?string

Optional key that makes the request safe to retry: a retry with the same key returns the cards the first request made instead of adding them again. Scoped to the credential and session.

Length1 <= length <= 255

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/sessions/string/canvas/nodes" \  -H "Content-Type: application/json" \  -d '{    "nodes": [      {        "kind": "text"      }    ]  }'
{  "nodes": [    {      "id": "string",      "kind": "text",      "label": "string",      "position": {        "x": 0,        "y": 0      },      "width": 0,      "height": 0,      "locked": true,      "ports": {        "inputs": [          {            "id": "prompt",            "type": "text",            "maxConnections": 0,            "connected": 0          }        ],        "output": "text"      },      "inputs": [        {          "port": "string",          "sourceNodeId": "string",          "order": 0        }      ],      "text": "string",      "asset": {        "assetId": "string",        "type": "image",        "url": "string",        "thumbnailUrl": "string",        "width": 0,        "height": 0,        "duration": 0,        "name": "string"      },      "pending": true,      "prompt": "string",      "modelId": "string",      "aspectRatio": "string",      "resolution": "string",      "numOutputs": 0,      "duration": 0,      "durationMode": "string",      "generateAudio": true,      "customSettings": {},      "promptGuide": "string",      "runCount": 0,      "runs": [        {          "id": "string",          "index": 0,          "status": "waiting",          "processId": "string",          "canvasRunId": "string",          "modelId": "string",          "startedAt": "2019-08-24T14:15:22Z",          "creditsEstimated": 0,          "outputs": [            {              "assetId": "string",              "type": "image",              "url": "string",              "thumbnailUrl": "string",              "width": 0,              "height": 0,              "duration": 0,              "name": "string"            }          ],          "text": "string",          "error": "string"        }      ],      "selectedOutput": {        "runId": "string",        "outputIndex": 0      },      "output": null,      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ],  "refs": {    "property1": "string",    "property2": "string"  },  "edges": [    {      "id": "string",      "sourceNodeId": "string",      "targetNodeId": "string",      "targetPort": "prompt",      "type": "text",      "order": 0    }  ]}
{  "error": {    "code": "string",    "message": "string",    "requestId": "string"  }}
{  "error": {    "code": "string",    "message": "string",    "requestId": "string"  }}
{  "error": {    "code": "string",    "message": "string",    "requestId": "string"  }}
{  "error": {    "code": "string",    "message": "string",    "requestId": "string"  }}
{  "error": {    "code": "string",    "message": "string",    "requestId": "string"  }}
{  "error": {    "code": "string",    "message": "string",    "requestId": "string"  }}