{"openapi":"3.1.0","info":{"title":"ask2cents API","version":"0.3.0","description":"Get a second opinion in seconds: people and agents pay 2¢ for short, blunt feedback from a chosen persona, asked from inside the AI client they already use."},"servers":[{"url":"http://ask2cents.com"}],"paths":{"/api/health":{"get":{"operationId":"get_api_health","summary":"Check that the Worker is up","x-auth":"public","description":"Answers without touching D1 or any provider, so a smoke check can tell the Worker from its dependencies.","security":[],"responses":{"200":{"description":"The Worker is serving, and the target it was built for.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"target":{"type":"string","enum":["local","preview","production"]}},"required":["ok","target"],"additionalProperties":false}}}}}}},"/api/me":{"get":{"operationId":"get_api_me","summary":"Who is signed in","x-auth":"user","description":"The caller's Clerk ids and the subject that owns data and pays: the user in b2c, the active workspace in b2b.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The signed-in caller.","content":{"application/json":{"schema":{"type":"object","properties":{"userId":{"type":"string"},"organizationId":{"type":["string","null"]},"organizationRole":{"type":["string","null"]},"subjectId":{"type":"string"}},"required":["userId","organizationId","organizationRole","subjectId"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"operationId":"delete_api_me","summary":"Delete my account","x-auth":"user","description":"Deletes the caller's Clerk user, which signs them out everywhere, then erases everything the product holds about them, as Clerk's `user.deleted` webhook does: in b2c their plan is cancelled first, then their files, their Loops contact and their D1 rows go. Needs a sign-in or reverification within 10 minutes (Clerk's `strict` preset); the app calls it through Clerk's `useReverification()`.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"Signed in too long ago: Clerk's reverification error (`clerk_error.reason` is `reverification-error`), or, in b2b, no active workspace (`organization_required`).","content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false},{"type":"object","properties":{"clerk_error":{"type":"object","properties":{"type":{"type":"string","const":"forbidden"},"reason":{"type":"string","const":"reverification-error"},"metadata":{"type":"object","properties":{"reverification":{"type":"string"}},"required":["reverification"],"additionalProperties":false}},"required":["type","reason","metadata"],"additionalProperties":false}},"required":["clerk_error"],"additionalProperties":false}]}}}},"502":{"description":"Clerk didn't delete the user; nothing was erased, so trying again is safe (`account_not_deleted`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/me/export":{"get":{"operationId":"get_api_me_export","summary":"Download my data","x-auth":"user","description":"Everything the product holds about the caller, as a JSON file (`Content-Disposition: attachment`): their Clerk profile (names, email addresses, phone numbers, connected accounts), their Loops email contact (its properties and the mailing lists it is on), their account row, Product news consent, the files stored for them, and every table keyed to them.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The export.","content":{"application/json":{"schema":{"type":"object","properties":{"exportedAt":{"type":"string"},"account":{"anyOf":[{"type":"object","properties":{"id":{"type":"string"},"createdAt":{"type":["string","null"]},"lastSeenAt":{"type":["string","null"]},"activatedAt":{"type":["string","null"]}},"required":["id","createdAt","lastSeenAt","activatedAt"],"additionalProperties":false},{"type":"null"}]},"profile":{"anyOf":[{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},{"type":"null"}]},"emailContact":{"anyOf":[{"type":"object","properties":{"properties":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{}},"mailingLists":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"],"additionalProperties":false}}},"required":["properties","mailingLists"],"additionalProperties":false},{"type":"null"}]},"productNews":{"type":"object","properties":{"status":{"type":"string","enum":["off","pending","on"],"description":"`pending` until the person clicks the link in the confirmation email."},"requestedAt":{"type":["string","null"]},"confirmedAt":{"type":["string","null"]}},"required":["status","requestedAt","confirmedAt"],"additionalProperties":false},"files":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"size":{"type":"number"},"uploadedAt":{"type":"string"}},"required":["key","size","uploadedAt"],"additionalProperties":false}},"data":{"type":"object","propertyNames":{"type":"string"},"additionalProperties":{"type":"array","items":{}}}},"required":["exportedAt","account","profile","emailContact","productNews","files","data"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Clerk or Loops couldn't be read, so the export would miss the profile or the email contact (`export_unavailable`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/news":{"get":{"operationId":"get_api_news","summary":"Your Product news consent","x-auth":"user","description":"Whether the signed-in person gets Product news (marketing email): `off`, `pending` (asked, not confirmed) or `on`.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The consent.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["off","pending","on"],"description":"`pending` until the person clicks the link in the confirmation email."}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"post_api_news","summary":"Ask for Product news","x-auth":"user","description":"Double opt-in: queues a `news-confirm` email whose signed link (3 days, newest only) turns consent `on` once clicked. At most one email per five minutes; a repeat inside that window answers `pending` and sends none.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Already `on`; nothing sent.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"on"}},"required":["status"],"additionalProperties":false}}}},"202":{"description":"`pending`: the confirmation email is queued (or was, under five minutes ago).","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"pending"}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk or `NEWS_SIGNING_SECRET` isn't configured for this target (`news_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"operationId":"delete_api_news","summary":"Stop Product news","x-auth":"user","description":"Turns consent `off` at once and queues the person's Loops contact to leave the Product news list and be unsubscribed.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Off.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","const":"off"}},"required":["status"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/clerk":{"post":{"operationId":"post_api_webhooks_clerk","summary":"Receive Clerk events","x-auth":"webhook","description":"Called by Clerk through Svix. Each delivery runs once: a redelivered `svix-id` answers 200 with `duplicate: true` without running again. `email.created` (with \"Delivered by Clerk\" off) queues Clerk's email for sending through Loops, in the template for its type; one Clerk already delivered, or to a `+clerk_test` address, is ignored.\n\nCalled by the provider; the request is verified by its signature.","security":[],"responses":{"200":{"description":"Handled, ignored (an event type the product doesn't use) or a duplicate delivery.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"duplicate":{"type":"boolean"},"ignored":{"type":"string"}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"The Svix signature is missing, invalid or stale.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"No signing secret is set, or handling failed (the `email` queue included); Svix retries.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/loops":{"post":{"operationId":"post_api_webhooks_loops","summary":"Receive Loops events","x-auth":"webhook","description":"Called by Loops, signed Standard Webhooks style with `LOOPS_WEBHOOK_SECRET`. Delivery events become log lines naming the template, never the address: `email.delivered`, `email.hardBounced` as `email.bounced` and `email.spamReported` as `email.complained`. An unsubscribe moves the person's Product news consent to `off`: `contact.unsubscribed`, or `contact.mailingList.unsubscribed` from the Product news list. Each delivery runs once: a redelivered `webhook-id` answers 200 with `duplicate: true`.\n\nCalled by the provider; the request is verified by its signature.","security":[],"responses":{"200":{"description":"Handled, ignored (an event type the product doesn't use) or a duplicate delivery.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"duplicate":{"type":"boolean"},"ignored":{"type":"string"}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"The signature is missing, invalid or stale.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"No `LOOPS_WEBHOOK_SECRET` is set, or handling failed; Loops retries.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/files/download":{"get":{"operationId":"get_api_files_download","summary":"Download a file through a signed link","x-auth":"public","description":"The link that `signDownloadLink()` hands out from a product route that owns the file. It needs no session and works for whoever holds it until it expires (5 minutes at most). The file always downloads (`Content-Disposition: attachment`, `nosniff`).","security":[],"parameters":[{"name":"key","in":"query","required":true,"schema":{"type":"string","description":"The file's storage key, as the link carries it."}},{"name":"expires","in":"query","required":true,"schema":{"type":"string","description":"Expiry, in Unix seconds."}},{"name":"signature","in":"query","required":true,"schema":{"type":"string","description":"HMAC-SHA256 of key and expiry."}}],"responses":{"200":{"description":"The file's bytes, with its content type."},"403":{"description":"The link is expired, or its key, expiry or signature was edited."},"404":{"description":"The file no longer exists."},"503":{"description":"`STORAGE_SIGNING_SECRET` isn't set for this target.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/billing/checkout":{"post":{"operationId":"post_api_billing_checkout","summary":"Start a Stripe Checkout","x-auth":"user","description":"Opens a Stripe Checkout Session (Managed Payments) for the signed-in subject: a plan from the catalog by its key, or a credit pack under the `credits` model. Prices come from the catalog by lookup key; the client never names a Stripe price. The plan is granted only once Stripe's signed webhook confirms it.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"anyOf":[{"type":"object","properties":{"plan":{"type":"string","minLength":1,"maxLength":64},"interval":{"type":"string","enum":["month","year"]}},"required":["plan"],"additionalProperties":false},{"type":"object","properties":{"pack":{"type":"string","minLength":1,"maxLength":64}},"required":["pack"],"additionalProperties":false}]}}}},"responses":{"201":{"description":"Redirect the browser to `url`, Stripe's hosted Checkout.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"400":{"description":"The body is neither `{ plan, interval? }` nor `{ pack }` (`Validation failed`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"`Validation failed`, or `Invalid JSON body`."},"issues":{"type":"array","items":{"type":"object","properties":{"slot":{"type":"string","enum":["body","query","params"]},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["slot","issues"],"additionalProperties":false}}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`), on a personal account, which has no billing (`no_organization`), or not an admin of the active workspace (`not_admin`). Nothing reaches Stripe.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Billing is off for this target: no Stripe key, or a key of the wrong mode (`billing_off`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"The subject already has a subscription that grants access; change it in the portal (`already_subscribed`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"No such plan, a plan this model can't sell, or packs under a model without credits (`unknown_plan`, `packs_not_sold`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured, Stripe has no active price for a lookup key (`price_not_found`), or Stripe failed (`billing_unavailable`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/billing/portal":{"post":{"operationId":"post_api_billing_portal","summary":"Open the Stripe customer portal","x-auth":"user","description":"A Stripe customer portal session on the subject's own Customer, once it has paid for a subscription or a credit pack: payment methods, invoices, cancelling. It returns to `/app/billing?portal=returned`.","security":[{"clerkSession":[]}],"responses":{"201":{"description":"Redirect the browser to `url`.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`), on a personal account, which has no billing (`no_organization`), or not an admin of the active workspace (`not_admin`). Nothing reaches Stripe.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Billing is off for this target (`billing_off`), or the subject has no paid subscription or credit pack, even if it opened a Checkout (`no_billing_account`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured, or Stripe failed (`billing_unavailable`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/webhooks/stripe":{"post":{"operationId":"post_api_webhooks_stripe","summary":"Receive Stripe events","x-auth":"webhook","description":"Called by Stripe, signed with the endpoint's secret (`Stripe-Signature`, five minutes' tolerance). It is the only writer of billing state. Each event runs once: a redelivered event id answers 200 with `duplicate: true`, and an event older than the stored state never overwrites it.\n\nCalled by the provider; the request is verified by its signature.","security":[],"responses":{"200":{"description":"Handled, ignored (an event type or Customer billing doesn't act on) or a duplicate delivery.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean","const":true},"duplicate":{"type":"boolean"},"ignored":{"type":"string"}},"required":["ok"],"additionalProperties":false}}}},"400":{"description":"The signature is missing, invalid or stale (`invalid_signature`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Billing is off for this target (`billing_off`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"No signing secret is set, or handling failed or must wait for an earlier event; Stripe retries.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/key":{"get":{"operationId":"get_api_my_key","summary":"My key and balance","x-auth":"user","description":"The caller's primary key hint (never the secret) and 2¢ balance, split free/bought.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Key hint and balance.","content":{"application/json":{"schema":{"type":"object","properties":{"key_hint":{"type":["string","null"]},"credits":{"type":"number"},"free_credits":{"type":"number"},"bought_credits":{"type":"number"}},"required":["key_hint","credits","free_credits","bought_credits"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"post_api_my_key","summary":"Make my key","x-auth":"user","description":"Creates the primary key when there is none and returns the secret once (201); when one exists, answers its hint with a null secret.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"A key already exists; hint only.","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":["string","null"]},"key_hint":{"type":"string"}},"required":["api_key","key_hint"],"additionalProperties":false}}}},"201":{"description":"The new secret, shown once.","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string"},"key_hint":{"type":"string"}},"required":["api_key","key_hint"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/key/replace":{"post":{"operationId":"post_api_my_key_replace","summary":"Replace my key","x-auth":"user","description":"The old primary secret stops working at once; the new one is returned once. Named keys are unaffected.","security":[{"clerkSession":[]}],"responses":{"201":{"description":"The new secret, shown once.","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string"},"key_hint":{"type":"string"}},"required":["api_key","key_hint"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/keys":{"get":{"operationId":"get_api_my_keys","summary":"My keys","x-auth":"user","description":"Every key on the account (hints only), live and revoked.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The keys.","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["primary","named"]},"name":{"type":"string"},"hint":{"type":"string"},"created_at":{"type":"number"},"last_used_at":{"type":["number","null"]},"revoked_at":{"type":["number","null"]}},"required":["id","kind","name","hint","created_at","last_used_at","revoked_at"],"additionalProperties":false}}},"required":["keys"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"post_api_my_keys","summary":"Make a named key","x-auth":"user","description":"An extra key spending the same balance; at most 10 live named keys. The secret is returned once.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","maxLength":200}},"required":["name"]}}}},"responses":{"201":{"description":"The key and its one-time secret.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string","enum":["primary","named"]},"name":{"type":"string"},"hint":{"type":"string"},"created_at":{"type":"number"},"last_used_at":{"type":["number","null"]},"revoked_at":{"type":["number","null"]},"api_key":{"type":"string"}},"required":["id","kind","name","hint","created_at","last_used_at","revoked_at","api_key"],"additionalProperties":false}}}},"400":{"description":"The body isn't `{ name }` (`Validation failed`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"`Validation failed`, or `Invalid JSON body`."},"issues":{"type":"array","items":{"type":"object","properties":{"slot":{"type":"string","enum":["body","query","params"]},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["slot","issues"],"additionalProperties":false}}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Already 10 live named keys (`too_many_keys`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"The name is not 1-40 characters (`invalid_name`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/keys/{id}":{"delete":{"operationId":"delete_api_my_keys_id","summary":"Revoke a named key","x-auth":"user","description":"Stops the key at once. The primary key cannot be revoked here; replace it instead.","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"The key's id."}}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"revoked":{"type":"boolean","const":true}},"required":["revoked"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"No live named key with that id.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/claim":{"post":{"operationId":"post_api_my_claim","summary":"Claim an earlier key","x-auth":"user","description":"Moves a carried anonymous key's 2¢ onto this account: bought in full, free only enough to fill the free balance to 5 (the rest are destroyed). The claimed key is left empty. A key that had answers counts as this account's first success. On a target without billing yet it answers 503 `billing_not_configured`.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"key":{"type":"string","maxLength":200}},"required":["key"]}}}},"responses":{"200":{"description":"Claimed; what moved and the new balance.","content":{"application/json":{"schema":{"type":"object","properties":{"claimed":{"type":"boolean","const":true},"moved_bought":{"type":"number"},"moved_free":{"type":"number"},"credits":{"type":"number"}},"required":["claimed","moved_bought","moved_free","credits"],"additionalProperties":false}}}},"400":{"description":"The body isn't `{ key }` (`Validation failed`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string","description":"`Validation failed`, or `Invalid JSON body`."},"issues":{"type":"array","items":{"type":"object","properties":{"slot":{"type":"string","enum":["body","query","params"]},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"path":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["slot","issues"],"additionalProperties":false}}},"required":["error"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"No anonymous key by that secret (`key_not_found`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"409":{"description":"Already claimed, or its balance moved under the claim (`already_claimed` / `contended`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/personas":{"get":{"operationId":"get_api_my_personas","summary":"My personas","x-auth":"user","description":"Every persona the caller owns, with the editor's limits, free tries and jobs.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Personas, limits and jobs.","content":{"application/json":{"schema":{"type":"object","properties":{"personas":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":{}}}},"required":["personas"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/personas/{id}":{"get":{"operationId":"get_api_my_personas_id","summary":"One of my personas","x-auth":"user","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The persona.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"put":{"operationId":"put_api_my_personas_id","summary":"Edit a persona","x-auth":"user","description":"Every edit is a new brief version. While public the handle is fixed and the edit passes the publish check again (422 with reasons, 503 when the check cannot run).","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"handle":{"type":"string","maxLength":200},"name":{"type":"string","maxLength":1000},"focus":{"type":"string","maxLength":2000},"background":{"type":"string","maxLength":5000},"lens":{"type":"string","maxLength":5000},"asks":{"maxItems":20,"type":"array","items":{"type":"string","maxLength":1000}},"voice":{"type":"string","maxLength":2000},"never":{"type":"string","maxLength":2000}},"required":["handle","name","focus","background","lens","asks","voice","never"]}}}},"responses":{"200":{"description":"The persona.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"A rule broke or the check refused (reasons included).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"delete":{"operationId":"delete_api_my_personas_id","summary":"Delete a persona","x-auth":"user","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted.","content":{"application/json":{"schema":{"type":"object","properties":{"deleted":{"type":"boolean","const":true}},"required":["deleted"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/personas/{id}/publish":{"post":{"operationId":"post_api_my_personas_id_publish","summary":"Publish a persona","x-auth":"user","description":"Runs the publish check, then lists the persona under its job. A refusal answers 422 with the check's reasons.","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"job":{"type":"string","maxLength":50},"creator_name":{"type":"string","maxLength":200},"self_described":{"type":"boolean"}},"required":["job","creator_name"]}}}},"responses":{"200":{"description":"The persona, now public.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Input rules or the check refused.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reasons":{"type":"array","items":{"type":"string"}}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/personas/{id}/unpublish":{"post":{"operationId":"post_api_my_personas_id_unpublish","summary":"Unpublish a persona","x-auth":"user","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The persona, now private.","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/personas/{id}/try":{"post":{"operationId":"post_api_my_personas_id_try","summary":"Try a persona","x-auth":"user","description":"One editor try against the saved brief: five free per persona, then one 2¢. Tries record no answer and earn nothing.","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"question":{"type":"string","maxLength":20000}},"required":["question"]}}}},"responses":{"200":{"description":"The try's two cents.","content":{"application/json":{"schema":{"type":"object","properties":{"two_cents":{"type":"string"},"free_tries_left":{"type":"number"},"credits":{"type":"number"}},"required":["two_cents","free_tries_left","credits"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"402":{"description":"Free tries used up and no 2¢ left.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"The model failed; no try was used.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/earnings":{"get":{"operationId":"get_api_my_earnings","summary":"My earnings","x-auth":"user","description":"Held, payable, paying and paid cents (1¢ per bought-paid answer, payable after 30 days), per persona.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The earnings summary.","content":{"application/json":{"schema":{"type":"object","properties":{"held_cents":{"type":"number"},"payable_cents":{"type":"number"}},"required":["held_cents","payable_cents"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/payouts":{"get":{"operationId":"get_api_my_payouts","summary":"How I am paid","x-auth":"user","description":"Earnings, payout method and readiness, the $2 bar, conversion math and past payouts. ?refresh=stripe re-asks Stripe after onboarding.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The payout view.","content":{"application/json":{"schema":{"type":"object","properties":{"minimum_cents":{"type":"number"}},"required":["minimum_cents"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/payouts/stripe":{"post":{"operationId":"post_api_my_payouts_stripe","summary":"Start bank-details onboarding","x-auth":"user","description":"Creates (or resumes) the caller's Stripe Connect recipient account and returns the hosted onboarding link. Closed until payouts open on the target.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"country":{"type":"string"}}}}}},"responses":{"200":{"description":"The onboarding link.","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Closed, unsupported country, or no email on the account.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"502":{"description":"Stripe could not start the page.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/payouts/convert":{"post":{"operationId":"post_api_my_payouts_convert","summary":"Turn earnings into 2¢","x-auth":"user","description":"Eleven payable answers (11¢) become five bought 2¢, in whole blocks.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"What was converted.","content":{"application/json":{"schema":{"type":"object","properties":{"converted":{"type":"object","properties":{"credits":{"type":"number"},"cents":{"type":"number"}},"required":["credits","cents"],"additionalProperties":false}},"required":["converted"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Fewer than 11 payable answers.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/auto-topup":{"get":{"operationId":"get_api_my_auto_topup","summary":"My auto top-up","x-auth":"user","description":"Whether the same pack is re-bought at 10 2¢ left, recent automatic purchases, and any decline note.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"The state.","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}},"post":{"operationId":"post_api_my_auto_topup","summary":"Switch auto top-up off","x-auth":"user","description":"Only {enabled:false} is accepted; switching on happens at Checkout when the card is saved.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]}}}},"responses":{"200":{"description":"The new state.","content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Tried to switch it on here.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/admin/payouts":{"get":{"operationId":"get_api_admin_payouts","summary":"Owner: payouts and who is waiting","x-auth":"user","description":"Owner only (404 otherwise): every payout, and creators owed the minimum who cannot be paid yet, with why.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"Payouts and waiting creators.","content":{"application/json":{"schema":{"type":"object","properties":{"payouts":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["payouts"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not the owner.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/admin/payouts/prepare":{"post":{"operationId":"post_api_admin_payouts_prepare","summary":"Owner: prepare this month's payouts","x-auth":"user","description":"One prepared payout per creator owed $2+ who can be paid; nothing is sent.","security":[{"clerkSession":[]}],"responses":{"200":{"description":"What was prepared.","content":{"application/json":{"schema":{"type":"object","properties":{"prepared":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["prepared"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not the owner.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/admin/payouts/{id}/send":{"post":{"operationId":"post_api_admin_payouts_id_send","summary":"Owner: send a payout","x-auth":"user","description":"One Stripe transfer (idempotent per payout); its earnings become paid.","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The transfer id.","content":{"application/json":{"schema":{"type":"object","properties":{"reference":{"type":"string"}},"required":["reference"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not the owner, or no such payout.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"422":{"description":"Not prepared, payouts closed, or the creator is not ready.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/admin/payouts/{id}/cancel":{"post":{"operationId":"post_api_admin_payouts_id_cancel","summary":"Owner: cancel a payout","x-auth":"user","description":"Its earnings become payable again.","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Cancelled.","content":{"application/json":{"schema":{"type":"object","properties":{"cancelled":{"type":"boolean","const":true}},"required":["cancelled"],"additionalProperties":false}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not the owner, or not prepared.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/admin/reconcile":{"post":{"operationId":"post_api_admin_reconcile","summary":"Owner: refund/dispute reconciliation","x-auth":"user","description":"Applies a full purchase refund (unspent bought 2¢ removed; fraud also cancels earnings), a dispute (earnings cancelled since the purchase), or the zero-amount pack reclassification pass, by pack grant id. Runs while Managed Payments sends no refund/dispute webhook events.","security":[{"clerkSession":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"action":{"type":"string","enum":["refund","dispute","reclassify"]},"grant_id":{"type":"string"},"fraud":{"type":"boolean"}},"required":["action"]}}}},"responses":{"200":{"description":"What changed.","content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not the owner, or no such grant.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}},"/api/my/personas/{id}/ratings":{"get":{"operationId":"get_api_my_personas_id_ratings","summary":"Ratings of my persona","x-auth":"user","description":"Counted-rating stats, the flagged marker, and every rating with its note.","security":[{"clerkSession":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Stats and ratings.","content":{"application/json":{"schema":{"type":"object","properties":{"answers":{"type":"number"},"ratings":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":{}}}},"required":["answers","ratings"],"additionalProperties":{}}}}},"401":{"description":"No valid session (`sign_in_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"403":{"description":"b2b only: signed in with no active workspace (`organization_required`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"404":{"description":"Not yours or gone.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}},"503":{"description":"Clerk isn't configured for this target (`auth_not_configured`).","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}},"required":["error"],"additionalProperties":false}}}}}}}},"components":{"securitySchemes":{"clerkSession":{"type":"http","scheme":"bearer","description":"A Clerk session token. Same-origin browser calls send the `__session` cookie instead."}}}}