Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Upsert Batch Planner

integration.upsert_batch_plan

ProductionBounded custom (Class B)Deterministicstrictmoderatev1.0.0
No network

Overview

You send records plus keyFields. maxBatchRecords defaults to 1,000 (1–10,000). maxBatchBytes defaults to 1,048,576 (1 KiB–10 MiB). duplicateKey defaults to REJECT; KEEP_LAST keeps the last record for a key. Batches hold input indices, byte estimates and a SHA-256 fingerprint. Records are not copied into the answer. This does not execute an upsert or mutate payloads.

An upsert that re-sends the same key twice is not idempotent unless the caller plans the batches.

Reliability

Canonical JSON is sorted by key; records are never copied into the answer. UPSERT_PLAN_INVALID — trigger: empty keyFields or a duplicate under REJECT; retryable: no; next: send unique keys or KEEP_LAST. UPSERT_LIMIT_EXCEEDED — trigger: more than 50,000 records or one record larger than the batch byte cap; retryable: no; next: split the payload.

Context footprint

Indices and fingerprints only. A successful call costs 2 execution credits.

When to use it

When records must be partitioned into bounded, fingerprintable upsert batches.

When you need to execute the upsert or validate a record schema.

Scope

Note
Partitions records into deterministic upsert batches and SHA-256 idempotency groups.

Non-goals

  • Does not execute an upsert
  • Does not schedule API rate limits
  • Does not mutate payloads

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

data-transformation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call2 credits

File handling

Accepts file_refProduces file_refMax input2 MB

How we handle your data

Sensitive input, safe output
What this means

This skill may receive sensitive content, but it does not target sensitive data and returns only a structured non-sensitive result.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response does not contain submitted content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
recordsarrayYesBounded array of 0 through 50001 records; runtime accepts at most 50000.
keyFieldsarrayYesBounded array of 1 through 16 key field names used for idempotency grouping.
maxBatchRecordsintegerNoMaximum records per batch. Omit it for 1000.
maxBatchBytesintegerNoMaximum UTF-8 canonical bytes per batch. Omit it for 1048576.
duplicateKeystringNoREJECT fails on duplicates; KEEP_LAST keeps the last. Omit it for REJECT.

Output schema

FieldTypeRequiredDescription
batchCountintegerYesHow many batches were planned.
recordCountintegerYesHow many unique keys remain after duplicate handling.
duplicateKeystringYesApplied duplicate policy.
maxBatchRecordsintegerYesApplied maximum number of records allowed in one batch.
maxBatchBytesintegerYesApplied maximum canonical UTF-8 byte length allowed in one batch.
batchesarrayYesBounded array of 0 through 50000 index-only batch descriptors.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"integration.upsert_batch_plan","input":{"keyFields":["id"],"records":[{"id":"a"}]}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("integration.upsert_batch_plan", {"records":[{"n":1,"id":"a"},{"n":2,"id":"b"}],"keyFields":["id"]});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.
UPSERT_PLAN_INVALID400NoThe request payload failed this skill's input validation.
UPSERT_LIMIT_EXCEEDED429NoA size, quota, rate, or time limit was exceeded.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not execute an upsert
  • Does not schedule API rate limits
  • Does not mutate payloads
  • Calling the upsert API
  • Validating record schemas

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "integration.upsert_batch_plan",
  "input": {
    "records": [
      {
        "n": 1,
        "id": "a"
      },
      {
        "n": 2,
        "id": "b"
      }
    ],
    "keyFields": [
      "id"
    ]
  }
}

Examples

Two unique keys fit in one default batch

Inputjson
{
  "records": [
    {
      "n": 1,
      "id": "a"
    },
    {
      "n": 2,
      "id": "b"
    }
  ],
  "keyFields": [
    "id"
  ]
}
Expected outputjson
{
  "recordCount": 2,
  "batchCount": 1,
  "maxBatchBytes": 1048576,
  "duplicateKey": "REJECT",
  "maxBatchRecords": 1000,
  "batches": [
    {
      "indices": [
        0,
        1
      ],
      "recordCount": 2,
      "estimatedBytes": 32,
      "idempotencyFingerprint": "aed840b5eabc1e092391c784bf8a6ae67a7c536cf1a521689af490f6ea9ac42b"
    }
  ]
}
Tip
One batch holds both record indices.

KEEP_LAST keeps the later duplicate

Inputjson
{
  "records": [
    {
      "n": 1,
      "id": "a"
    },
    {
      "n": 2,
      "id": "a"
    }
  ],
  "duplicateKey": "KEEP_LAST",
  "keyFields": [
    "id"
  ]
}
Expected outputjson
{
  "recordCount": 1,
  "batchCount": 1,
  "maxBatchBytes": 1048576,
  "duplicateKey": "KEEP_LAST",
  "maxBatchRecords": 1000,
  "batches": [
    {
      "indices": [
        1
      ],
      "recordCount": 1,
      "estimatedBytes": 16,
      "idempotencyFingerprint": "3b18c8bfa27eeb355f2f3bf7568833352c719338fa8faa213f1428cfa0fa2975"
    }
  ]
}
Tip
Only index 1 remains for key a.
  • Split 50,000 records under a 1 MiB batch cap
  • Keep the last duplicate key

Avoid for

  • Calling the upsert API
  • Validating record schemas

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

validationintegrationtransformation