@primitivedotdev/sdk 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +3 -3
- package/dist/{api-JvyzQsXn.js → api-DoB7DrgV.js} +364 -22
- package/dist/contract/index.d.ts +2 -2
- package/dist/contract/index.js +1 -1
- package/dist/{errors-7E9sW9eX.d.ts → errors-DyuAXctD.d.ts} +1 -1
- package/dist/{index-DdSffRr0.d.ts → index-BDjVGtc8.d.ts} +455 -7
- package/dist/{index-DR978rq5.d.ts → index-iZWfb98V.d.ts} +275 -4
- package/dist/index.d.ts +8 -6
- package/dist/index.js +7 -4
- package/dist/openapi/index.js +1 -1
- package/dist/{operations.generated-CvXrZUzc.js → operations.generated-XrEy5EtX.js} +636 -3
- package/dist/parser/index.d.ts +1 -1
- package/dist/{types-yNU-Oiea.d.ts → types-QT2ss9ho.d.ts} +207 -3
- package/dist/webhook/index.d.ts +4 -4
- package/dist/webhook/index.js +1 -1
- package/dist/{webhook-BAwK8EOG.js → webhook-CwjCyFv-.js} +2559 -224
- package/dist/x402/index.d.ts +263 -0
- package/dist/x402/index.js +320 -0
- package/package.json +10 -4
|
@@ -79,7 +79,7 @@ const openapiDocument = {
|
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
"name": "Functions",
|
|
82
|
-
"description": "Deploy JavaScript handlers that run on inbound mail. Each function\nis a single ESM module whose default export is an object with an\nasync `fetch(request, env)` method, in the shape of a Workers-style\nhandler. Primitive signs each delivery and forwards the\n`Primitive-Signature` header to the handler; verify the raw request\nbody with `PRIMITIVE_WEBHOOK_SECRET` before trusting the parsed
|
|
82
|
+
"description": "Deploy JavaScript handlers that run on inbound mail. Each function\nis a single ESM module whose default export is an object with an\nasync `fetch(request, env)` method, in the shape of a Workers-style\nhandler. Primitive signs each delivery and forwards the\n`Primitive-Signature` header to the handler; verify the raw request\nbody with `PRIMITIVE_WEBHOOK_SECRET` before trusting the parsed event.\nThe `event` field is `email.received` for normal inbound mail, or a\nmachine-mail type (`email.bounced`, `email.tls_report`,\n`email.dmarc_report`, `email.dmarc_failure`) for bounces and reports;\nthe payload shape is otherwise identical. Code runs on\nPrimitive's edge runtime; there is no infrastructure to manage.\nSecrets land in `env` as encrypted bindings and are refreshed on\nevery redeploy.\n"
|
|
83
83
|
}
|
|
84
84
|
],
|
|
85
85
|
"paths": {
|
|
@@ -385,6 +385,128 @@ const openapiDocument = {
|
|
|
385
385
|
"429": { "$ref": "#/components/responses/RateLimited" }
|
|
386
386
|
}
|
|
387
387
|
} },
|
|
388
|
+
"/agent/accounts": { "post": {
|
|
389
|
+
"operationId": "createAgentAccount",
|
|
390
|
+
"summary": "Create an emailless agent account",
|
|
391
|
+
"description": "Creates an emailless agent account without authentication and returns a\none-time API key (prefixed `prim_`) plus a provisioned managed inbox.\nThe account is on the `agent` plan: reply-only (it can send only to\naddresses that have already sent it authenticated mail) with tight send\nlimits. Use the returned `api_key` as a Bearer token on later calls. The\naccount can be upgraded to a full developer account by confirming an\nemail through the claim flow. This endpoint does not require an API key.\n",
|
|
392
|
+
"tags": ["Agent"],
|
|
393
|
+
"security": [],
|
|
394
|
+
"requestBody": {
|
|
395
|
+
"required": true,
|
|
396
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAgentAccountInput" } } }
|
|
397
|
+
},
|
|
398
|
+
"responses": {
|
|
399
|
+
"200": {
|
|
400
|
+
"description": "Agent account created; the API key is returned once",
|
|
401
|
+
"headers": { "Cache-Control": {
|
|
402
|
+
"schema": { "type": "string" },
|
|
403
|
+
"description": "Always `no-store`"
|
|
404
|
+
} },
|
|
405
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
406
|
+
"type": "object",
|
|
407
|
+
"properties": { "data": { "$ref": "#/components/schemas/AgentAccountResult" } }
|
|
408
|
+
}] } } }
|
|
409
|
+
},
|
|
410
|
+
"400": { "$ref": "#/components/responses/ValidationError" },
|
|
411
|
+
"429": { "$ref": "#/components/responses/RateLimited" }
|
|
412
|
+
}
|
|
413
|
+
} },
|
|
414
|
+
"/agent/claim/start": { "post": {
|
|
415
|
+
"operationId": "startAgentClaim",
|
|
416
|
+
"summary": "Start an agent account email claim",
|
|
417
|
+
"description": "Begins upgrading an emailless `agent` account into a full `developer`\naccount by confirming an email address. Authenticated by the agent's own\nAPI key (the org is taken from the credential). Sends a verification\ncode to the supplied email and returns the claim session id plus resend\ntiming. Submit the code to `/agent/claim/verify` to complete the\nupgrade. Confirming an email that already belongs to a Primitive account\nis rejected.\n",
|
|
418
|
+
"tags": ["Agent"],
|
|
419
|
+
"requestBody": {
|
|
420
|
+
"required": true,
|
|
421
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/StartAgentClaimInput" } } }
|
|
422
|
+
},
|
|
423
|
+
"responses": {
|
|
424
|
+
"200": {
|
|
425
|
+
"description": "Claim started and verification email sent",
|
|
426
|
+
"headers": { "Cache-Control": {
|
|
427
|
+
"schema": { "type": "string" },
|
|
428
|
+
"description": "Always `no-store`"
|
|
429
|
+
} },
|
|
430
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
431
|
+
"type": "object",
|
|
432
|
+
"properties": { "data": { "$ref": "#/components/schemas/AgentClaimStartResult" } }
|
|
433
|
+
}] } } }
|
|
434
|
+
},
|
|
435
|
+
"400": { "$ref": "#/components/responses/ValidationError" },
|
|
436
|
+
"401": { "$ref": "#/components/responses/Unauthorized" },
|
|
437
|
+
"404": { "$ref": "#/components/responses/NotFound" },
|
|
438
|
+
"409": {
|
|
439
|
+
"description": "The email is already in use, or the account is not claimable",
|
|
440
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
441
|
+
},
|
|
442
|
+
"429": { "$ref": "#/components/responses/RateLimited" }
|
|
443
|
+
}
|
|
444
|
+
} },
|
|
445
|
+
"/agent/claim/verify": { "post": {
|
|
446
|
+
"operationId": "verifyAgentClaim",
|
|
447
|
+
"summary": "Verify an agent account email claim",
|
|
448
|
+
"description": "Confirms the verification code emailed by `/agent/claim/start` and\nupgrades the account to the `developer` plan. The org id, API key, and\nmanaged inbox all carry over; the send cap lifts. Authenticated by the\nagent's own API key.\n",
|
|
449
|
+
"tags": ["Agent"],
|
|
450
|
+
"requestBody": {
|
|
451
|
+
"required": true,
|
|
452
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/VerifyAgentClaimInput" } } }
|
|
453
|
+
},
|
|
454
|
+
"responses": {
|
|
455
|
+
"200": {
|
|
456
|
+
"description": "Claim verified; account upgraded to developer",
|
|
457
|
+
"headers": { "Cache-Control": {
|
|
458
|
+
"schema": { "type": "string" },
|
|
459
|
+
"description": "Always `no-store`"
|
|
460
|
+
} },
|
|
461
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
462
|
+
"type": "object",
|
|
463
|
+
"properties": { "data": { "$ref": "#/components/schemas/AgentClaimResult" } }
|
|
464
|
+
}] } } }
|
|
465
|
+
},
|
|
466
|
+
"400": { "$ref": "#/components/responses/ValidationError" },
|
|
467
|
+
"401": { "$ref": "#/components/responses/Unauthorized" },
|
|
468
|
+
"404": { "$ref": "#/components/responses/NotFound" },
|
|
469
|
+
"409": {
|
|
470
|
+
"description": "The account is already claimed, or the email is in use",
|
|
471
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
472
|
+
},
|
|
473
|
+
"410": {
|
|
474
|
+
"description": "The claim or its verification code has expired",
|
|
475
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
476
|
+
},
|
|
477
|
+
"429": { "$ref": "#/components/responses/RateLimited" }
|
|
478
|
+
}
|
|
479
|
+
} },
|
|
480
|
+
"/agent/claim/link": { "post": {
|
|
481
|
+
"operationId": "createAgentClaimLink",
|
|
482
|
+
"summary": "Create a browser claim link",
|
|
483
|
+
"description": "Mints an opaque, single-use link an agent can hand to a human to\ncomplete the email-confirmation upgrade in a browser. Authenticated by\nthe agent's own API key. `claim_url` is null when the API host cannot\nresolve a web origin to build the link.\n",
|
|
484
|
+
"tags": ["Agent"],
|
|
485
|
+
"requestBody": {
|
|
486
|
+
"required": false,
|
|
487
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/CreateAgentClaimLinkInput" } } }
|
|
488
|
+
},
|
|
489
|
+
"responses": {
|
|
490
|
+
"200": {
|
|
491
|
+
"description": "Claim link created",
|
|
492
|
+
"headers": { "Cache-Control": {
|
|
493
|
+
"schema": { "type": "string" },
|
|
494
|
+
"description": "Always `no-store`"
|
|
495
|
+
} },
|
|
496
|
+
"content": { "application/json": { "schema": { "allOf": [{ "$ref": "#/components/schemas/SuccessEnvelope" }, {
|
|
497
|
+
"type": "object",
|
|
498
|
+
"properties": { "data": { "$ref": "#/components/schemas/AgentClaimLinkResult" } }
|
|
499
|
+
}] } } }
|
|
500
|
+
},
|
|
501
|
+
"401": { "$ref": "#/components/responses/Unauthorized" },
|
|
502
|
+
"404": { "$ref": "#/components/responses/NotFound" },
|
|
503
|
+
"409": {
|
|
504
|
+
"description": "The account is not claimable (not an agent account, or already claimed)",
|
|
505
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" } } }
|
|
506
|
+
},
|
|
507
|
+
"429": { "$ref": "#/components/responses/RateLimited" }
|
|
508
|
+
}
|
|
509
|
+
} },
|
|
388
510
|
"/cli/logout": { "post": {
|
|
389
511
|
"operationId": "cliLogout",
|
|
390
512
|
"summary": "Revoke the current CLI OAuth session",
|
|
@@ -729,6 +851,25 @@ const openapiDocument = {
|
|
|
729
851
|
"format": "date-time"
|
|
730
852
|
},
|
|
731
853
|
"description": "Filter emails created on or before this timestamp"
|
|
854
|
+
},
|
|
855
|
+
{
|
|
856
|
+
"name": "since",
|
|
857
|
+
"in": "query",
|
|
858
|
+
"schema": {
|
|
859
|
+
"type": "string",
|
|
860
|
+
"maxLength": 200
|
|
861
|
+
},
|
|
862
|
+
"description": "Forward-tail cursor. Returns rows that became visible AFTER this\ncursor, oldest-first, so a caller can stream new inbound mail by\nre-passing the cursor from each response. Mutually exclusive with\n`cursor` (which pages history newest-first). Pass the `meta.cursor`\nfrom the previous `since` response; an empty page means caught up.\n"
|
|
863
|
+
},
|
|
864
|
+
{
|
|
865
|
+
"name": "wait",
|
|
866
|
+
"in": "query",
|
|
867
|
+
"schema": {
|
|
868
|
+
"type": "integer",
|
|
869
|
+
"minimum": 0,
|
|
870
|
+
"maximum": 30
|
|
871
|
+
},
|
|
872
|
+
"description": "Long-poll: hold the request up to this many seconds waiting for new\nmail past `since`, returning as soon as any arrives (or an empty\npage when the wait elapses). Requires `since`. Omitted means no wait\n(returns immediately); the server treats an absent value as 0. NOT\ngiven an OpenAPI `default` on purpose: a default makes some\ngenerators (e.g. openapi-python-client) send `wait=0` on every call,\nwhich then fails the `wait` requires `since` check for plain history\nlistings.\n"
|
|
732
873
|
}
|
|
733
874
|
],
|
|
734
875
|
"responses": {
|
|
@@ -1668,7 +1809,7 @@ const openapiDocument = {
|
|
|
1668
1809
|
"post": {
|
|
1669
1810
|
"operationId": "createFunction",
|
|
1670
1811
|
"summary": "Deploy a function",
|
|
1671
|
-
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to
|
|
1812
|
+
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to a webhook event whose `event` field is\n`email.received` for normal inbound mail, or a machine-mail type\n(`email.bounced`, `email.tls_report`, `email.dmarc_report`,\n`email.dmarc_failure`) for bounces and reports. Code is bundled\nbefore being uploaded; ship a single self-contained file rather\nthan relying on external imports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8, stored with each deployment\nattempt, and sent to the runtime so stack traces can resolve to\noriginal source files.\n\n**Routing.** On successful deploy, the function code is live\nin the runtime, but inbound mail will not reach it until at\nleast one route is bound. Routes are managed from the Primitive\ndashboard. A `deploy_status` of `deployed` means the script is\ninstalled, not that the function is receiving mail. The\ninternal runtime URL is not returned by the API and is not a\ncustomer-facing integration surface.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`,\n`PRIMITIVE_API_BASE_URL`) already bound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n",
|
|
1672
1813
|
"tags": ["Functions"],
|
|
1673
1814
|
"requestBody": {
|
|
1674
1815
|
"required": true,
|
|
@@ -2979,6 +3120,177 @@ const openapiDocument = {
|
|
|
2979
3120
|
"orgs"
|
|
2980
3121
|
]
|
|
2981
3122
|
},
|
|
3123
|
+
"PlanLimits": {
|
|
3124
|
+
"type": "object",
|
|
3125
|
+
"description": "Plan-derived quota limits for an account.",
|
|
3126
|
+
"properties": {
|
|
3127
|
+
"storage_mb": { "type": "number" },
|
|
3128
|
+
"send_per_hour": { "type": "number" },
|
|
3129
|
+
"send_per_day": { "type": "number" },
|
|
3130
|
+
"api_per_minute": { "type": "number" },
|
|
3131
|
+
"webhooks_max_global": { "type": ["number", "null"] },
|
|
3132
|
+
"webhooks_per_domain": { "type": "boolean" },
|
|
3133
|
+
"filters_per_domain": { "type": "boolean" },
|
|
3134
|
+
"spam_thresholds_per_domain": { "type": "boolean" }
|
|
3135
|
+
},
|
|
3136
|
+
"required": [
|
|
3137
|
+
"storage_mb",
|
|
3138
|
+
"send_per_hour",
|
|
3139
|
+
"send_per_day",
|
|
3140
|
+
"api_per_minute",
|
|
3141
|
+
"webhooks_max_global",
|
|
3142
|
+
"webhooks_per_domain",
|
|
3143
|
+
"filters_per_domain",
|
|
3144
|
+
"spam_thresholds_per_domain"
|
|
3145
|
+
]
|
|
3146
|
+
},
|
|
3147
|
+
"CreateAgentAccountInput": {
|
|
3148
|
+
"type": "object",
|
|
3149
|
+
"additionalProperties": false,
|
|
3150
|
+
"properties": {
|
|
3151
|
+
"terms_accepted": {
|
|
3152
|
+
"type": "boolean",
|
|
3153
|
+
"enum": [true],
|
|
3154
|
+
"description": "Must be true to accept the Terms of Service and Privacy Policy."
|
|
3155
|
+
},
|
|
3156
|
+
"device_name": {
|
|
3157
|
+
"type": "string",
|
|
3158
|
+
"minLength": 1,
|
|
3159
|
+
"maxLength": 80,
|
|
3160
|
+
"description": "Optional label for the device or agent creating the account."
|
|
3161
|
+
}
|
|
3162
|
+
},
|
|
3163
|
+
"required": ["terms_accepted"]
|
|
3164
|
+
},
|
|
3165
|
+
"AgentAccountUpgradeHint": {
|
|
3166
|
+
"type": "object",
|
|
3167
|
+
"description": "In-band pointer to the upgrade path for an agent account.",
|
|
3168
|
+
"properties": {
|
|
3169
|
+
"plan": {
|
|
3170
|
+
"type": "string",
|
|
3171
|
+
"enum": ["developer"]
|
|
3172
|
+
},
|
|
3173
|
+
"description": { "type": "string" },
|
|
3174
|
+
"claim_path": { "type": "string" }
|
|
3175
|
+
},
|
|
3176
|
+
"required": [
|
|
3177
|
+
"plan",
|
|
3178
|
+
"description",
|
|
3179
|
+
"claim_path"
|
|
3180
|
+
]
|
|
3181
|
+
},
|
|
3182
|
+
"AgentAccountResult": {
|
|
3183
|
+
"type": "object",
|
|
3184
|
+
"properties": {
|
|
3185
|
+
"api_key": {
|
|
3186
|
+
"type": "string",
|
|
3187
|
+
"description": "One-time API key (prefixed `prim_`). Shown once; store it securely."
|
|
3188
|
+
},
|
|
3189
|
+
"org_id": {
|
|
3190
|
+
"type": "string",
|
|
3191
|
+
"format": "uuid"
|
|
3192
|
+
},
|
|
3193
|
+
"address": {
|
|
3194
|
+
"type": ["string", "null"],
|
|
3195
|
+
"description": "Provisioned managed inbox FQDN, or null if the inbox publish was deferred."
|
|
3196
|
+
},
|
|
3197
|
+
"plan": {
|
|
3198
|
+
"type": "string",
|
|
3199
|
+
"enum": ["agent"]
|
|
3200
|
+
},
|
|
3201
|
+
"limits": { "$ref": "#/components/schemas/PlanLimits" },
|
|
3202
|
+
"upgrade": { "$ref": "#/components/schemas/AgentAccountUpgradeHint" }
|
|
3203
|
+
},
|
|
3204
|
+
"required": [
|
|
3205
|
+
"api_key",
|
|
3206
|
+
"org_id",
|
|
3207
|
+
"address",
|
|
3208
|
+
"plan",
|
|
3209
|
+
"limits",
|
|
3210
|
+
"upgrade"
|
|
3211
|
+
]
|
|
3212
|
+
},
|
|
3213
|
+
"StartAgentClaimInput": {
|
|
3214
|
+
"type": "object",
|
|
3215
|
+
"additionalProperties": false,
|
|
3216
|
+
"properties": { "email": {
|
|
3217
|
+
"type": "string",
|
|
3218
|
+
"format": "email",
|
|
3219
|
+
"maxLength": 254,
|
|
3220
|
+
"description": "Email to confirm. Must not already belong to a Primitive account."
|
|
3221
|
+
} },
|
|
3222
|
+
"required": ["email"]
|
|
3223
|
+
},
|
|
3224
|
+
"AgentClaimStartResult": {
|
|
3225
|
+
"type": "object",
|
|
3226
|
+
"properties": {
|
|
3227
|
+
"claim_session_id": { "type": "string" },
|
|
3228
|
+
"resend_after_seconds": { "type": "integer" },
|
|
3229
|
+
"expires_in_seconds": { "type": "integer" }
|
|
3230
|
+
},
|
|
3231
|
+
"required": [
|
|
3232
|
+
"claim_session_id",
|
|
3233
|
+
"resend_after_seconds",
|
|
3234
|
+
"expires_in_seconds"
|
|
3235
|
+
]
|
|
3236
|
+
},
|
|
3237
|
+
"VerifyAgentClaimInput": {
|
|
3238
|
+
"type": "object",
|
|
3239
|
+
"additionalProperties": false,
|
|
3240
|
+
"properties": { "verification_code": {
|
|
3241
|
+
"type": "string",
|
|
3242
|
+
"minLength": 1,
|
|
3243
|
+
"maxLength": 32,
|
|
3244
|
+
"description": "The verification code emailed by the claim start step."
|
|
3245
|
+
} },
|
|
3246
|
+
"required": ["verification_code"]
|
|
3247
|
+
},
|
|
3248
|
+
"AgentClaimResult": {
|
|
3249
|
+
"type": "object",
|
|
3250
|
+
"properties": {
|
|
3251
|
+
"org_id": {
|
|
3252
|
+
"type": "string",
|
|
3253
|
+
"format": "uuid"
|
|
3254
|
+
},
|
|
3255
|
+
"plan": {
|
|
3256
|
+
"type": "string",
|
|
3257
|
+
"enum": ["developer"]
|
|
3258
|
+
},
|
|
3259
|
+
"email": {
|
|
3260
|
+
"type": "string",
|
|
3261
|
+
"format": "email"
|
|
3262
|
+
},
|
|
3263
|
+
"limits": { "$ref": "#/components/schemas/PlanLimits" }
|
|
3264
|
+
},
|
|
3265
|
+
"required": [
|
|
3266
|
+
"org_id",
|
|
3267
|
+
"plan",
|
|
3268
|
+
"email",
|
|
3269
|
+
"limits"
|
|
3270
|
+
]
|
|
3271
|
+
},
|
|
3272
|
+
"CreateAgentClaimLinkInput": {
|
|
3273
|
+
"type": "object",
|
|
3274
|
+
"additionalProperties": false,
|
|
3275
|
+
"description": "No fields; an empty object is accepted.",
|
|
3276
|
+
"properties": {}
|
|
3277
|
+
},
|
|
3278
|
+
"AgentClaimLinkResult": {
|
|
3279
|
+
"type": "object",
|
|
3280
|
+
"properties": {
|
|
3281
|
+
"claim_token": { "type": "string" },
|
|
3282
|
+
"claim_url": {
|
|
3283
|
+
"type": ["string", "null"],
|
|
3284
|
+
"description": "Browser URL to hand to a human, or null if no web origin is configured."
|
|
3285
|
+
},
|
|
3286
|
+
"expires_in_seconds": { "type": "integer" }
|
|
3287
|
+
},
|
|
3288
|
+
"required": [
|
|
3289
|
+
"claim_token",
|
|
3290
|
+
"claim_url",
|
|
3291
|
+
"expires_in_seconds"
|
|
3292
|
+
]
|
|
3293
|
+
},
|
|
2982
3294
|
"CliLogoutInput": {
|
|
2983
3295
|
"type": "object",
|
|
2984
3296
|
"additionalProperties": false,
|
|
@@ -3017,6 +3329,16 @@ const openapiDocument = {
|
|
|
3017
3329
|
},
|
|
3018
3330
|
"email": { "type": "string" },
|
|
3019
3331
|
"plan": { "type": "string" },
|
|
3332
|
+
"limits": { "$ref": "#/components/schemas/PlanLimits" },
|
|
3333
|
+
"entitlements": {
|
|
3334
|
+
"type": "array",
|
|
3335
|
+
"items": { "type": "string" },
|
|
3336
|
+
"description": "Granted org entitlement keys (sorted). A headless caller reads its\ncapabilities here — e.g. an emailless agent seeing only\n[\"send_mail\", \"send_to_known_addresses\"] knows it is reply-only.\n"
|
|
3337
|
+
},
|
|
3338
|
+
"managed_inbox_address": {
|
|
3339
|
+
"type": ["string", "null"],
|
|
3340
|
+
"description": "The managed inbox FQDN to reply as, or null if the org has no managed inbox."
|
|
3341
|
+
},
|
|
3020
3342
|
"created_at": {
|
|
3021
3343
|
"type": "string",
|
|
3022
3344
|
"format": "date-time"
|
|
@@ -3044,6 +3366,9 @@ const openapiDocument = {
|
|
|
3044
3366
|
"id",
|
|
3045
3367
|
"email",
|
|
3046
3368
|
"plan",
|
|
3369
|
+
"limits",
|
|
3370
|
+
"entitlements",
|
|
3371
|
+
"managed_inbox_address",
|
|
3047
3372
|
"created_at",
|
|
3048
3373
|
"discard_content_on_webhook_confirmed"
|
|
3049
3374
|
]
|
|
@@ -6082,6 +6407,39 @@ const operationManifest = [
|
|
|
6082
6407
|
},
|
|
6083
6408
|
"email": { "type": "string" },
|
|
6084
6409
|
"plan": { "type": "string" },
|
|
6410
|
+
"limits": {
|
|
6411
|
+
"type": "object",
|
|
6412
|
+
"description": "Plan-derived quota limits for an account.",
|
|
6413
|
+
"properties": {
|
|
6414
|
+
"storage_mb": { "type": "number" },
|
|
6415
|
+
"send_per_hour": { "type": "number" },
|
|
6416
|
+
"send_per_day": { "type": "number" },
|
|
6417
|
+
"api_per_minute": { "type": "number" },
|
|
6418
|
+
"webhooks_max_global": { "type": ["number", "null"] },
|
|
6419
|
+
"webhooks_per_domain": { "type": "boolean" },
|
|
6420
|
+
"filters_per_domain": { "type": "boolean" },
|
|
6421
|
+
"spam_thresholds_per_domain": { "type": "boolean" }
|
|
6422
|
+
},
|
|
6423
|
+
"required": [
|
|
6424
|
+
"storage_mb",
|
|
6425
|
+
"send_per_hour",
|
|
6426
|
+
"send_per_day",
|
|
6427
|
+
"api_per_minute",
|
|
6428
|
+
"webhooks_max_global",
|
|
6429
|
+
"webhooks_per_domain",
|
|
6430
|
+
"filters_per_domain",
|
|
6431
|
+
"spam_thresholds_per_domain"
|
|
6432
|
+
]
|
|
6433
|
+
},
|
|
6434
|
+
"entitlements": {
|
|
6435
|
+
"type": "array",
|
|
6436
|
+
"items": { "type": "string" },
|
|
6437
|
+
"description": "Granted org entitlement keys (sorted). A headless caller reads its\ncapabilities here — e.g. an emailless agent seeing only\n[\"send_mail\", \"send_to_known_addresses\"] knows it is reply-only.\n"
|
|
6438
|
+
},
|
|
6439
|
+
"managed_inbox_address": {
|
|
6440
|
+
"type": ["string", "null"],
|
|
6441
|
+
"description": "The managed inbox FQDN to reply as, or null if the org has no managed inbox."
|
|
6442
|
+
},
|
|
6085
6443
|
"created_at": {
|
|
6086
6444
|
"type": "string",
|
|
6087
6445
|
"format": "date-time"
|
|
@@ -6109,6 +6467,9 @@ const operationManifest = [
|
|
|
6109
6467
|
"id",
|
|
6110
6468
|
"email",
|
|
6111
6469
|
"plan",
|
|
6470
|
+
"limits",
|
|
6471
|
+
"entitlements",
|
|
6472
|
+
"managed_inbox_address",
|
|
6112
6473
|
"created_at",
|
|
6113
6474
|
"discard_content_on_webhook_confirmed"
|
|
6114
6475
|
]
|
|
@@ -6278,6 +6639,148 @@ const operationManifest = [
|
|
|
6278
6639
|
"tag": "Account",
|
|
6279
6640
|
"tagCommand": "account"
|
|
6280
6641
|
},
|
|
6642
|
+
{
|
|
6643
|
+
"binaryResponse": false,
|
|
6644
|
+
"bodyRequired": true,
|
|
6645
|
+
"command": "create-agent-account",
|
|
6646
|
+
"description": "Creates an emailless agent account without authentication and returns a\none-time API key (prefixed `prim_`) plus a provisioned managed inbox.\nThe account is on the `agent` plan: reply-only (it can send only to\naddresses that have already sent it authenticated mail) with tight send\nlimits. Use the returned `api_key` as a Bearer token on later calls. The\naccount can be upgraded to a full developer account by confirming an\nemail through the claim flow. This endpoint does not require an API key.\n",
|
|
6647
|
+
"hasJsonBody": true,
|
|
6648
|
+
"method": "POST",
|
|
6649
|
+
"operationId": "createAgentAccount",
|
|
6650
|
+
"path": "/agent/accounts",
|
|
6651
|
+
"pathParams": [],
|
|
6652
|
+
"queryParams": [],
|
|
6653
|
+
"requestSchema": {
|
|
6654
|
+
"type": "object",
|
|
6655
|
+
"additionalProperties": false,
|
|
6656
|
+
"properties": {
|
|
6657
|
+
"terms_accepted": {
|
|
6658
|
+
"type": "boolean",
|
|
6659
|
+
"enum": [true],
|
|
6660
|
+
"description": "Must be true to accept the Terms of Service and Privacy Policy."
|
|
6661
|
+
},
|
|
6662
|
+
"device_name": {
|
|
6663
|
+
"type": "string",
|
|
6664
|
+
"minLength": 1,
|
|
6665
|
+
"maxLength": 80,
|
|
6666
|
+
"description": "Optional label for the device or agent creating the account."
|
|
6667
|
+
}
|
|
6668
|
+
},
|
|
6669
|
+
"required": ["terms_accepted"]
|
|
6670
|
+
},
|
|
6671
|
+
"responseSchema": {
|
|
6672
|
+
"type": "object",
|
|
6673
|
+
"properties": {
|
|
6674
|
+
"api_key": {
|
|
6675
|
+
"type": "string",
|
|
6676
|
+
"description": "One-time API key (prefixed `prim_`). Shown once; store it securely."
|
|
6677
|
+
},
|
|
6678
|
+
"org_id": {
|
|
6679
|
+
"type": "string",
|
|
6680
|
+
"format": "uuid"
|
|
6681
|
+
},
|
|
6682
|
+
"address": {
|
|
6683
|
+
"type": ["string", "null"],
|
|
6684
|
+
"description": "Provisioned managed inbox FQDN, or null if the inbox publish was deferred."
|
|
6685
|
+
},
|
|
6686
|
+
"plan": {
|
|
6687
|
+
"type": "string",
|
|
6688
|
+
"enum": ["agent"]
|
|
6689
|
+
},
|
|
6690
|
+
"limits": {
|
|
6691
|
+
"type": "object",
|
|
6692
|
+
"description": "Plan-derived quota limits for an account.",
|
|
6693
|
+
"properties": {
|
|
6694
|
+
"storage_mb": { "type": "number" },
|
|
6695
|
+
"send_per_hour": { "type": "number" },
|
|
6696
|
+
"send_per_day": { "type": "number" },
|
|
6697
|
+
"api_per_minute": { "type": "number" },
|
|
6698
|
+
"webhooks_max_global": { "type": ["number", "null"] },
|
|
6699
|
+
"webhooks_per_domain": { "type": "boolean" },
|
|
6700
|
+
"filters_per_domain": { "type": "boolean" },
|
|
6701
|
+
"spam_thresholds_per_domain": { "type": "boolean" }
|
|
6702
|
+
},
|
|
6703
|
+
"required": [
|
|
6704
|
+
"storage_mb",
|
|
6705
|
+
"send_per_hour",
|
|
6706
|
+
"send_per_day",
|
|
6707
|
+
"api_per_minute",
|
|
6708
|
+
"webhooks_max_global",
|
|
6709
|
+
"webhooks_per_domain",
|
|
6710
|
+
"filters_per_domain",
|
|
6711
|
+
"spam_thresholds_per_domain"
|
|
6712
|
+
]
|
|
6713
|
+
},
|
|
6714
|
+
"upgrade": {
|
|
6715
|
+
"type": "object",
|
|
6716
|
+
"description": "In-band pointer to the upgrade path for an agent account.",
|
|
6717
|
+
"properties": {
|
|
6718
|
+
"plan": {
|
|
6719
|
+
"type": "string",
|
|
6720
|
+
"enum": ["developer"]
|
|
6721
|
+
},
|
|
6722
|
+
"description": { "type": "string" },
|
|
6723
|
+
"claim_path": { "type": "string" }
|
|
6724
|
+
},
|
|
6725
|
+
"required": [
|
|
6726
|
+
"plan",
|
|
6727
|
+
"description",
|
|
6728
|
+
"claim_path"
|
|
6729
|
+
]
|
|
6730
|
+
}
|
|
6731
|
+
},
|
|
6732
|
+
"required": [
|
|
6733
|
+
"api_key",
|
|
6734
|
+
"org_id",
|
|
6735
|
+
"address",
|
|
6736
|
+
"plan",
|
|
6737
|
+
"limits",
|
|
6738
|
+
"upgrade"
|
|
6739
|
+
]
|
|
6740
|
+
},
|
|
6741
|
+
"sdkName": "createAgentAccount",
|
|
6742
|
+
"summary": "Create an emailless agent account",
|
|
6743
|
+
"tag": "Agent",
|
|
6744
|
+
"tagCommand": "agent"
|
|
6745
|
+
},
|
|
6746
|
+
{
|
|
6747
|
+
"binaryResponse": false,
|
|
6748
|
+
"bodyRequired": false,
|
|
6749
|
+
"command": "create-agent-claim-link",
|
|
6750
|
+
"description": "Mints an opaque, single-use link an agent can hand to a human to\ncomplete the email-confirmation upgrade in a browser. Authenticated by\nthe agent's own API key. `claim_url` is null when the API host cannot\nresolve a web origin to build the link.\n",
|
|
6751
|
+
"hasJsonBody": true,
|
|
6752
|
+
"method": "POST",
|
|
6753
|
+
"operationId": "createAgentClaimLink",
|
|
6754
|
+
"path": "/agent/claim/link",
|
|
6755
|
+
"pathParams": [],
|
|
6756
|
+
"queryParams": [],
|
|
6757
|
+
"requestSchema": {
|
|
6758
|
+
"type": "object",
|
|
6759
|
+
"additionalProperties": false,
|
|
6760
|
+
"description": "No fields; an empty object is accepted.",
|
|
6761
|
+
"properties": {}
|
|
6762
|
+
},
|
|
6763
|
+
"responseSchema": {
|
|
6764
|
+
"type": "object",
|
|
6765
|
+
"properties": {
|
|
6766
|
+
"claim_token": { "type": "string" },
|
|
6767
|
+
"claim_url": {
|
|
6768
|
+
"type": ["string", "null"],
|
|
6769
|
+
"description": "Browser URL to hand to a human, or null if no web origin is configured."
|
|
6770
|
+
},
|
|
6771
|
+
"expires_in_seconds": { "type": "integer" }
|
|
6772
|
+
},
|
|
6773
|
+
"required": [
|
|
6774
|
+
"claim_token",
|
|
6775
|
+
"claim_url",
|
|
6776
|
+
"expires_in_seconds"
|
|
6777
|
+
]
|
|
6778
|
+
},
|
|
6779
|
+
"sdkName": "createAgentClaimLink",
|
|
6780
|
+
"summary": "Create a browser claim link",
|
|
6781
|
+
"tag": "Agent",
|
|
6782
|
+
"tagCommand": "agent"
|
|
6783
|
+
},
|
|
6281
6784
|
{
|
|
6282
6785
|
"binaryResponse": false,
|
|
6283
6786
|
"bodyRequired": true,
|
|
@@ -6330,6 +6833,46 @@ const operationManifest = [
|
|
|
6330
6833
|
"tag": "Agent",
|
|
6331
6834
|
"tagCommand": "agent"
|
|
6332
6835
|
},
|
|
6836
|
+
{
|
|
6837
|
+
"binaryResponse": false,
|
|
6838
|
+
"bodyRequired": true,
|
|
6839
|
+
"command": "start-agent-claim",
|
|
6840
|
+
"description": "Begins upgrading an emailless `agent` account into a full `developer`\naccount by confirming an email address. Authenticated by the agent's own\nAPI key (the org is taken from the credential). Sends a verification\ncode to the supplied email and returns the claim session id plus resend\ntiming. Submit the code to `/agent/claim/verify` to complete the\nupgrade. Confirming an email that already belongs to a Primitive account\nis rejected.\n",
|
|
6841
|
+
"hasJsonBody": true,
|
|
6842
|
+
"method": "POST",
|
|
6843
|
+
"operationId": "startAgentClaim",
|
|
6844
|
+
"path": "/agent/claim/start",
|
|
6845
|
+
"pathParams": [],
|
|
6846
|
+
"queryParams": [],
|
|
6847
|
+
"requestSchema": {
|
|
6848
|
+
"type": "object",
|
|
6849
|
+
"additionalProperties": false,
|
|
6850
|
+
"properties": { "email": {
|
|
6851
|
+
"type": "string",
|
|
6852
|
+
"format": "email",
|
|
6853
|
+
"maxLength": 254,
|
|
6854
|
+
"description": "Email to confirm. Must not already belong to a Primitive account."
|
|
6855
|
+
} },
|
|
6856
|
+
"required": ["email"]
|
|
6857
|
+
},
|
|
6858
|
+
"responseSchema": {
|
|
6859
|
+
"type": "object",
|
|
6860
|
+
"properties": {
|
|
6861
|
+
"claim_session_id": { "type": "string" },
|
|
6862
|
+
"resend_after_seconds": { "type": "integer" },
|
|
6863
|
+
"expires_in_seconds": { "type": "integer" }
|
|
6864
|
+
},
|
|
6865
|
+
"required": [
|
|
6866
|
+
"claim_session_id",
|
|
6867
|
+
"resend_after_seconds",
|
|
6868
|
+
"expires_in_seconds"
|
|
6869
|
+
]
|
|
6870
|
+
},
|
|
6871
|
+
"sdkName": "startAgentClaim",
|
|
6872
|
+
"summary": "Start an agent account email claim",
|
|
6873
|
+
"tag": "Agent",
|
|
6874
|
+
"tagCommand": "agent"
|
|
6875
|
+
},
|
|
6333
6876
|
{
|
|
6334
6877
|
"binaryResponse": false,
|
|
6335
6878
|
"bodyRequired": true,
|
|
@@ -6412,6 +6955,80 @@ const operationManifest = [
|
|
|
6412
6955
|
"tag": "Agent",
|
|
6413
6956
|
"tagCommand": "agent"
|
|
6414
6957
|
},
|
|
6958
|
+
{
|
|
6959
|
+
"binaryResponse": false,
|
|
6960
|
+
"bodyRequired": true,
|
|
6961
|
+
"command": "verify-agent-claim",
|
|
6962
|
+
"description": "Confirms the verification code emailed by `/agent/claim/start` and\nupgrades the account to the `developer` plan. The org id, API key, and\nmanaged inbox all carry over; the send cap lifts. Authenticated by the\nagent's own API key.\n",
|
|
6963
|
+
"hasJsonBody": true,
|
|
6964
|
+
"method": "POST",
|
|
6965
|
+
"operationId": "verifyAgentClaim",
|
|
6966
|
+
"path": "/agent/claim/verify",
|
|
6967
|
+
"pathParams": [],
|
|
6968
|
+
"queryParams": [],
|
|
6969
|
+
"requestSchema": {
|
|
6970
|
+
"type": "object",
|
|
6971
|
+
"additionalProperties": false,
|
|
6972
|
+
"properties": { "verification_code": {
|
|
6973
|
+
"type": "string",
|
|
6974
|
+
"minLength": 1,
|
|
6975
|
+
"maxLength": 32,
|
|
6976
|
+
"description": "The verification code emailed by the claim start step."
|
|
6977
|
+
} },
|
|
6978
|
+
"required": ["verification_code"]
|
|
6979
|
+
},
|
|
6980
|
+
"responseSchema": {
|
|
6981
|
+
"type": "object",
|
|
6982
|
+
"properties": {
|
|
6983
|
+
"org_id": {
|
|
6984
|
+
"type": "string",
|
|
6985
|
+
"format": "uuid"
|
|
6986
|
+
},
|
|
6987
|
+
"plan": {
|
|
6988
|
+
"type": "string",
|
|
6989
|
+
"enum": ["developer"]
|
|
6990
|
+
},
|
|
6991
|
+
"email": {
|
|
6992
|
+
"type": "string",
|
|
6993
|
+
"format": "email"
|
|
6994
|
+
},
|
|
6995
|
+
"limits": {
|
|
6996
|
+
"type": "object",
|
|
6997
|
+
"description": "Plan-derived quota limits for an account.",
|
|
6998
|
+
"properties": {
|
|
6999
|
+
"storage_mb": { "type": "number" },
|
|
7000
|
+
"send_per_hour": { "type": "number" },
|
|
7001
|
+
"send_per_day": { "type": "number" },
|
|
7002
|
+
"api_per_minute": { "type": "number" },
|
|
7003
|
+
"webhooks_max_global": { "type": ["number", "null"] },
|
|
7004
|
+
"webhooks_per_domain": { "type": "boolean" },
|
|
7005
|
+
"filters_per_domain": { "type": "boolean" },
|
|
7006
|
+
"spam_thresholds_per_domain": { "type": "boolean" }
|
|
7007
|
+
},
|
|
7008
|
+
"required": [
|
|
7009
|
+
"storage_mb",
|
|
7010
|
+
"send_per_hour",
|
|
7011
|
+
"send_per_day",
|
|
7012
|
+
"api_per_minute",
|
|
7013
|
+
"webhooks_max_global",
|
|
7014
|
+
"webhooks_per_domain",
|
|
7015
|
+
"filters_per_domain",
|
|
7016
|
+
"spam_thresholds_per_domain"
|
|
7017
|
+
]
|
|
7018
|
+
}
|
|
7019
|
+
},
|
|
7020
|
+
"required": [
|
|
7021
|
+
"org_id",
|
|
7022
|
+
"plan",
|
|
7023
|
+
"email",
|
|
7024
|
+
"limits"
|
|
7025
|
+
]
|
|
7026
|
+
},
|
|
7027
|
+
"sdkName": "verifyAgentClaim",
|
|
7028
|
+
"summary": "Verify an agent account email claim",
|
|
7029
|
+
"tag": "Agent",
|
|
7030
|
+
"tagCommand": "agent"
|
|
7031
|
+
},
|
|
6415
7032
|
{
|
|
6416
7033
|
"binaryResponse": false,
|
|
6417
7034
|
"bodyRequired": true,
|
|
@@ -8309,6 +8926,22 @@ const operationManifest = [
|
|
|
8309
8926
|
"name": "date_to",
|
|
8310
8927
|
"required": false,
|
|
8311
8928
|
"type": "string"
|
|
8929
|
+
},
|
|
8930
|
+
{
|
|
8931
|
+
"description": "Forward-tail cursor. Returns rows that became visible AFTER this\ncursor, oldest-first, so a caller can stream new inbound mail by\nre-passing the cursor from each response. Mutually exclusive with\n`cursor` (which pages history newest-first). Pass the `meta.cursor`\nfrom the previous `since` response; an empty page means caught up.\n",
|
|
8932
|
+
"enum": null,
|
|
8933
|
+
"name": "since",
|
|
8934
|
+
"required": false,
|
|
8935
|
+
"type": "string"
|
|
8936
|
+
},
|
|
8937
|
+
{
|
|
8938
|
+
"description": "Long-poll: hold the request up to this many seconds waiting for new\nmail past `since`, returning as soon as any arrives (or an empty\npage when the wait elapses). Requires `since`. Omitted means no wait\n(returns immediately); the server treats an absent value as 0. NOT\ngiven an OpenAPI `default` on purpose: a default makes some\ngenerators (e.g. openapi-python-client) send `wait=0` on every call,\nwhich then fails the `wait` requires `since` check for plain history\nlistings.\n",
|
|
8939
|
+
"enum": null,
|
|
8940
|
+
"maximum": 30,
|
|
8941
|
+
"minimum": 0,
|
|
8942
|
+
"name": "wait",
|
|
8943
|
+
"required": false,
|
|
8944
|
+
"type": "integer"
|
|
8312
8945
|
}
|
|
8313
8946
|
],
|
|
8314
8947
|
"requestSchema": null,
|
|
@@ -9318,7 +9951,7 @@ const operationManifest = [
|
|
|
9318
9951
|
"binaryResponse": false,
|
|
9319
9952
|
"bodyRequired": true,
|
|
9320
9953
|
"command": "create-function",
|
|
9321
|
-
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to
|
|
9954
|
+
"description": "Creates and deploys a new function. The handler must be a single\nESM module whose default export is an object with an async\n`fetch(request, env)` method (Workers-style). Primitive signs\neach delivery and forwards the `Primitive-Signature` header to\nthe handler. Verify the raw request body with\n`PRIMITIVE_WEBHOOK_SECRET` before parsing JSON; after verification\nthe request body parses to a webhook event whose `event` field is\n`email.received` for normal inbound mail, or a machine-mail type\n(`email.bounced`, `email.tls_report`, `email.dmarc_report`,\n`email.dmarc_failure`) for bounces and reports. Code is bundled\nbefore being uploaded; ship a single self-contained file rather\nthan relying on external imports.\n\n**Code limits.** `code` is capped at 1 MiB UTF-8. `sourceMap`\n(optional) is capped at 5 MiB UTF-8, stored with each deployment\nattempt, and sent to the runtime so stack traces can resolve to\noriginal source files.\n\n**Routing.** On successful deploy, the function code is live\nin the runtime, but inbound mail will not reach it until at\nleast one route is bound. Routes are managed from the Primitive\ndashboard. A `deploy_status` of `deployed` means the script is\ninstalled, not that the function is receiving mail. The\ninternal runtime URL is not returned by the API and is not a\ncustomer-facing integration surface.\n\n**Secrets.** New functions ship with the managed secrets\n(`PRIMITIVE_WEBHOOK_SECRET`, `PRIMITIVE_API_KEY`,\n`PRIMITIVE_API_BASE_URL`) already bound. Add user-set secrets via\n`POST /functions/{id}/secrets`; secret writes only land in the\nrunning handler on the next redeploy.\n",
|
|
9322
9955
|
"hasJsonBody": true,
|
|
9323
9956
|
"method": "POST",
|
|
9324
9957
|
"operationId": "createFunction",
|