Upsert Batch Planner
integration.upsert_batch_plan
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
Non-goals
- Does not execute an upsert
- Does not schedule API rate limits
- Does not mutate payloads
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
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.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| records | array | Yes | Bounded array of 0 through 50001 records; runtime accepts at most 50000. |
| keyFields | array | Yes | Bounded array of 1 through 16 key field names used for idempotency grouping. |
| maxBatchRecords | integer | No | Maximum records per batch. Omit it for 1000. |
| maxBatchBytes | integer | No | Maximum UTF-8 canonical bytes per batch. Omit it for 1048576. |
| duplicateKey | string | No | REJECT fails on duplicates; KEEP_LAST keeps the last. Omit it for REJECT. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| batchCount | integer | Yes | How many batches were planned. |
| recordCount | integer | Yes | How many unique keys remain after duplicate handling. |
| duplicateKey | string | Yes | Applied duplicate policy. |
| maxBatchRecords | integer | Yes | Applied maximum number of records allowed in one batch. |
| maxBatchBytes | integer | Yes | Applied maximum canonical UTF-8 byte length allowed in one batch. |
| batches | array | Yes | Bounded array of 0 through 50000 index-only batch descriptors. |
API contract
POST /v1/executecurl -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"}]}}'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
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
| UPSERT_PLAN_INVALID | 400 | No | The request payload failed this skill's input validation. |
| UPSERT_LIMIT_EXCEEDED | 429 | No | A size, quota, rate, or time limit was exceeded. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 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)
{
"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
{
"records": [
{
"n": 1,
"id": "a"
},
{
"n": 2,
"id": "b"
}
],
"keyFields": [
"id"
]
}{
"recordCount": 2,
"batchCount": 1,
"maxBatchBytes": 1048576,
"duplicateKey": "REJECT",
"maxBatchRecords": 1000,
"batches": [
{
"indices": [
0,
1
],
"recordCount": 2,
"estimatedBytes": 32,
"idempotencyFingerprint": "aed840b5eabc1e092391c784bf8a6ae67a7c536cf1a521689af490f6ea9ac42b"
}
]
}KEEP_LAST keeps the later duplicate
{
"records": [
{
"n": 1,
"id": "a"
},
{
"n": 2,
"id": "a"
}
],
"duplicateKey": "KEEP_LAST",
"keyFields": [
"id"
]
}{
"recordCount": 1,
"batchCount": 1,
"maxBatchBytes": 1048576,
"duplicateKey": "KEEP_LAST",
"maxBatchRecords": 1000,
"batches": [
{
"indices": [
1
],
"recordCount": 1,
"estimatedBytes": 16,
"idempotencyFingerprint": "3b18c8bfa27eeb355f2f3bf7568833352c719338fa8faa213f1428cfa0fa2975"
}
]
}Recommended use cases
- Split 50,000 records under a 1 MiB batch cap
- Keep the last duplicate key
Avoid for
- Calling the upsert API
- Validating record schemas
Related skills
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.