{"openapi":"3.1.0","info":{"title":"Aporta API","version":"0.0.1","description":"Gateway de pagamentos para desenvolvedores (sandbox). Envelope `{ data, success, error }`. Métodos: PIX · BOLETO · CARD · CRYPTO. Auth: `Authorization: Bearer sk_test_…` ou sessão merchant. POSTs autenticados aceitam `Idempotency-Key` (24h por loja + ambiente + chave/sessão): mesma chave e mesmo corpo devolvem a resposta guardada com `Idempotent-Replayed: true`; corpo diferente → 422 `IDEMPOTENCY_KEY_REUSED`; mesma chave ainda em andamento → 409 `IDEMPOTENCY_KEY_IN_USE`.","contact":{"name":"Aporta / Iniciador","url":"https://aporta.cc"}},"servers":[{"url":"https://api.aporta.cc","description":"Produção / sandbox (api.aporta.cc)"},{"url":"https://aporta-api.fly.dev","description":"Fly app (fallback)"},{"url":"http://localhost:3001","description":"Local"}],"tags":[{"name":"Health"},{"name":"Auth"},{"name":"Stores & members","description":"Dashboard sessions only (#32): many stores per user, roles owner/admin/developer/viewer, invitations, audit log."},{"name":"Customers"},{"name":"Products"},{"name":"Checkouts"},{"name":"Payment links"},{"name":"Transparents"},{"name":"Coupons"},{"name":"Subscriptions"},{"name":"Webhooks"},{"name":"Payouts"},{"name":"PIX send"},{"name":"Crypto"},{"name":"Store"},{"name":"API keys"},{"name":"KYC"},{"name":"Disputes"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"API key `sk_test_…` / `sk_live_…` or merchant session `sess_…`"}},"parameters":{"StoreHeader":{"name":"X-Aporta-Store","in":"header","required":false,"description":"Dashboard sessions: the store (id or slug) this request is for, validated against the caller's active membership on every request (404 `STORE_NOT_FOUND` otherwise). Defaults to the session's last store. API keys are bound to one store and env: sending another store here is 400 `STORE_HEADER_NOT_ALLOWED`.","schema":{"type":"string"}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":false,"description":"Até 255 caracteres ASCII visíveis (use um UUID). Guardada 24h por loja + ambiente + API key/sessão. Repetir com o mesmo corpo devolve a mesma resposta (header `Idempotent-Replayed: true`) sem executar de novo. Respostas 5xx, 401, 403, 409 e 429 não ficam guardadas: dá para tentar de novo com a mesma chave.","schema":{"type":"string","minLength":1,"maxLength":255}}},"schemas":{"EnvelopeSuccess":{"type":"object","required":["data","success","error"],"properties":{"data":{},"success":{"const":true},"error":{"const":null}}},"EnvelopeError":{"type":"object","required":["data","success","error"],"properties":{"data":{"const":null},"success":{"const":false},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}},"CountAmount":{"type":"object","required":["count","amount"],"properties":{"count":{"type":"integer"},"amount":{"type":"integer","description":"centavos"}}},"Pagination":{"type":"object","description":"Cursor pagination on list endpoints. Query: after | before | limit (1–100, default 100) | startDate | endDate (YYYY-MM-DD, America/Sao_Paulo). Order: createdAt DESC, id DESC. Do not pass after and before together.","properties":{"hasMore":{"type":"boolean","description":"More items in the scroll direction"},"next":{"type":["string","null"],"description":"Pass as ?after= for the next page (forward)"},"before":{"type":["string","null"],"description":"Pass as ?before= for the previous page (backward)"}}},"ListEnvelope":{"type":"object","required":["data","success","error","pagination"],"properties":{"data":{"type":"array","items":{}},"success":{"const":true},"error":{"const":null},"pagination":{"$ref":"#/components/schemas/Pagination"}}},"PaymentMethod":{"type":"string","enum":["PIX","BOLETO","CARD","CRYPTO"]},"WebhookEventName":{"type":"string","enum":["checkout.completed","checkout.refunded","checkout.expired","checkout.disputed","transparent.completed","transparent.refunded","transparent.disputed","subscription.completed","subscription.cancelled","subscription.plan_changed","subscription.renewed","subscription.trial_started","payout.completed","payout.failed","transfer.completed","transfer.failed","crypto.receive.completed","crypto.send.completed","crypto.send.failed"]}}},"security":[{"bearerAuth":[]}],"paths":{"/v1/fees/calculate":{"get":{"tags":["Store"],"summary":"Fee calculator (sandbox stub)","security":[{"bearerAuth":[]}],"parameters":[{"name":"amount","in":"query","required":true,"schema":{"type":"integer"}},{"name":"method","in":"query","schema":{"$ref":"#/components/schemas/PaymentMethod"}}],"responses":{"200":{"description":"Estimate"}}}},"/v1/stores/list":{"get":{"tags":["Store"],"summary":"List stores (current store stub)","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Store list"}}}},"/v1/checkouts/apply-coupon":{"post":{"tags":["Checkouts"],"summary":"Apply coupon on pending checkout","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Updated checkout"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/":{"get":{"tags":["Health"],"summary":"API root","security":[],"responses":{"200":{"description":"Metadata"}}}},"/v1/health":{"get":{"tags":["Health"],"summary":"Healthcheck (liveness only: status, service, timestamp)","security":[],"responses":{"200":{"description":"OK"}}}},"/v1/health/webhooks":{"get":{"tags":["Health"],"summary":"Webhook worker heartbeat (status page)","description":"200 when the delivery poller is ticking and no delivery is overdue by 15 min in either env; 503 otherwise. Booleans only.","security":[],"responses":{"200":{"description":"`{ status: \"ok\", worker, overdue }`"},"503":{"description":"`status: \"degraded\"`"}}}},"/v1/openapi.json":{"get":{"tags":["Health"],"summary":"OpenAPI 3.1 document","security":[],"responses":{"200":{"description":"OpenAPI JSON"}}}},"/v1/customers/create":{"post":{"tags":["Customers"],"summary":"Create customer","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"name":{"type":"string"},"cellphone":{"type":"string"},"taxId":{"type":"string"},"zipCode":{"type":"string"},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"example":{"email":"ana@exemplo.com","name":"Ana Silva","cellphone":"11999999999","taxId":"529.982.247-25","zipCode":"01310-100"}}}},"description":"Idempotent per person: an existing customer with the same e-mail (case and surrounding spaces ignored) or the same tax id digits is returned with 200 instead of creating a duplicate.","responses":{"200":{"description":"Existing customer"},"201":{"description":"Created","content":{"application/json":{"example":{"data":{"id":"cust_01example","email":"ana@exemplo.com","name":"Ana Silva","taxId":"52998224725","createdAt":"2026-09-29T03:00:00.000Z","devMode":true},"success":true,"error":null}}}},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/customers/list":{"get":{"tags":["Customers"],"summary":"List customers (cursor pagination)","description":"Returns `{ data, success, error, pagination: { hasMore, next, before } }`. Order createdAt DESC.","parameters":[{"name":"after","in":"query","schema":{"type":"string"},"description":"Cursor — id from previous pagination.next"},{"name":"before","in":"query","schema":{"type":"string"},"description":"Cursor — id from previous pagination.before (do not combine with after)"},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"name":"startDate","in":"query","schema":{"type":"string","example":"2026-09-01"},"description":"YYYY-MM-DD (America/Sao_Paulo)"},{"name":"endDate","in":"query","schema":{"type":"string","example":"2026-09-29"},"description":"YYYY-MM-DD (America/Sao_Paulo)"},{"name":"email","in":"query","schema":{"type":"string"}},{"name":"taxId","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"},"example":{"data":[{"id":"cust_01example","email":"ana@exemplo.com","name":"Ana Silva","createdAt":"2026-09-29T03:00:00.000Z","devMode":true}],"success":true,"error":null,"pagination":{"hasMore":false,"next":null,"before":null}}}}}}}},"/v1/customers/{id}":{"get":{"tags":["Customers"],"summary":"Get customer","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Customer"},"404":{"description":"Not found"}}}},"/v1/customers/delete":{"post":{"tags":["Customers"],"summary":"Delete customer","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}}}}}},"responses":{"200":{"description":"Deleted"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/products/create":{"post":{"tags":["Products"],"summary":"Create product","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","price"],"properties":{"name":{"type":"string"},"price":{"type":"integer","description":"Centavos BRL"},"description":{"type":"string"},"currency":{"type":"string","enum":["BRL"]},"cycle":{"type":"string","enum":["WEEKLY","MONTHLY","QUARTERLY","SEMIANNUALLY","ANNUALLY"]}}}}}},"responses":{"201":{"description":"Created"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/products/list":{"get":{"tags":["Products"],"summary":"List products","responses":{"200":{"description":"Page"}}}},"/v1/checkouts/create":{"post":{"tags":["Checkouts"],"summary":"Create hosted checkout","description":"Provide `amount` or catalog `items[]`. Optional `upSellProductId` for bump offer on hosted `/c/[id]`. Amounts in centavos BRL. Auth: `Bearer sk_test_…`.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["methods"],"properties":{"amount":{"type":"integer","minimum":1,"description":"Centavos BRL"},"items":{"type":"array","items":{"type":"object","required":["id","quantity"],"properties":{"id":{"type":"string"},"quantity":{"type":"integer","minimum":1}}}},"methods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethod"},"minItems":1},"customerId":{"type":"string"},"returnUrl":{"type":"string"},"completionUrl":{"type":"string"},"couponCode":{"type":"string"},"upSellProductId":{"type":"string"},"dueDate":{"type":"string","description":"YYYY-MM-DD (boleto)"},"interest":{"type":"object","properties":{"value":{"type":"integer"}}},"fine":{"type":"object","properties":{"value":{"type":"integer"},"type":{"type":"string","enum":["PERCENTAGE","FIXED"]}}},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"examples":{"pix":{"summary":"PIX only","value":{"amount":1990,"methods":["PIX"],"customerId":"cust_01example","returnUrl":"https://loja.exemplo/obrigado"}},"boleto":{"summary":"Boleto with due date","value":{"amount":9900,"methods":["BOLETO"],"customerId":"cust_01example","dueDate":"2026-10-15","interest":{"value":100},"fine":{"value":200,"type":"FIXED"}}},"card":{"summary":"Card installments","value":{"amount":14990,"methods":["CARD"],"customerId":"cust_01example","installments":3}},"crypto":{"summary":"Crypto USDT","value":{"amount":5000,"methods":["CRYPTO"],"customerId":"cust_01example","asset":"USDT"}},"multiMethod":{"summary":"PIX + BOLETO + CARD","value":{"amount":4990,"methods":["PIX","BOLETO","CARD"],"customerId":"cust_01example","returnUrl":"https://loja.exemplo/voltar","completionUrl":"https://loja.exemplo/pago"}}}}}},"responses":{"201":{"description":"Created with url + rails","content":{"application/json":{"examples":{"pix":{"summary":"PIX checkout created","value":{"data":{"id":"chk_01example","amount":1990,"status":"PENDING","methods":["PIX"],"url":"https://aporta.cc/c/chk_01example","rails":{"PIX":{"brCode":"00020126...Aporta","brCodeBase64":"data:image/png;base64,...","expiresAt":"2026-09-29T04:00:00.000Z","expiresIn":3600}},"customerId":"cust_01example","devMode":true,"createdAt":"2026-09-29T03:00:00.000Z"},"success":true,"error":null}}}}}},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/list":{"get":{"tags":["Checkouts"],"summary":"List checkouts","description":"Cursor pagination: `after` | `before` | `limit` | `startDate` | `endDate`. Response includes `pagination: { hasMore, next, before }`.","parameters":[{"name":"after","in":"query","schema":{"type":"string"}},{"name":"before","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"name":"startDate","in":"query","schema":{"type":"string"}},{"name":"endDate","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListEnvelope"}}}}}}},"/v1/checkouts/from-link":{"post":{"tags":["Checkouts"],"summary":"Open a payment link: new PENDING checkout from the link's terms","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["paymentLinkId"],"properties":{"paymentLinkId":{"type":"string"}}}}}},"responses":{"201":{"description":"Checkout"},"400":{"description":"Link cancelled, refunded or expired"},"404":{"description":"Payment link not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/one":{"get":{"tags":["Checkouts"],"summary":"Get checkout by id","description":"With the public hosted-page key `sk_test_aporta_dev`, a checkout of any store is found by id in the sandbox database, then in production, and only the fields the hosted page renders are returned (`devMode: false` = live).","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Checkout"}}}},"/v1/checkouts/check":{"get":{"tags":["Checkouts"],"summary":"Check checkout status","parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Checkout"}}}},"/v1/checkouts/simulate-payment":{"post":{"tags":["Checkouts"],"summary":"Sandbox: mark checkout PAID","responses":{"200":{"description":"Paid"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/accept-upsell":{"post":{"tags":["Checkouts"],"summary":"Accept upsell bump (adds product price to amount)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}}}}}},"responses":{"200":{"description":"Updated checkout"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/simulate-dispute":{"post":{"tags":["Disputes"],"summary":"Sandbox stub: emit checkout.disputed","responses":{"200":{"description":"Event emitted"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/refund":{"post":{"tags":["Checkouts"],"summary":"Refund or cancel checkout","responses":{"200":{"description":"Refunded/cancelled"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/delete":{"post":{"tags":["Checkouts"],"summary":"Delete unpaid checkout","responses":{"200":{"description":"Deleted"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/payment-links/create":{"post":{"tags":["Payment links"],"summary":"Create reusable payment link","responses":{"201":{"description":"Created"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/transparents/create":{"post":{"tags":["Transparents"],"summary":"Create transparent charge (PIX/BOLETO/CARD/CRYPTO)","description":"Direct (non-hosted) charge. One `method` per request. Amounts in centavos BRL.","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["method","amount"],"properties":{"method":{"$ref":"#/components/schemas/PaymentMethod"},"amount":{"type":"integer","minimum":1},"customerId":{"type":"string"},"customer":{"type":"object","properties":{"name":{"type":"string"},"email":{"type":"string"},"cellphone":{"type":"string"},"taxId":{"type":"string"}}},"expiresIn":{"type":"integer","minimum":1,"maximum":86400},"installments":{"type":"integer","minimum":1,"maximum":12},"asset":{"type":"string","description":"Crypto asset e.g. USDT"},"dueDate":{"type":"string","description":"YYYY-MM-DD (boleto)"},"ensureSameTaxId":{"type":"boolean"},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"examples":{"pix":{"summary":"PIX","value":{"method":"PIX","amount":2500,"customerId":"cust_01example","expiresIn":3600,"ensureSameTaxId":true}},"boleto":{"summary":"Boleto","value":{"method":"BOLETO","amount":9900,"customer":{"name":"Ana Silva","email":"ana@exemplo.com","taxId":"529.982.247-25"},"dueDate":"2026-10-15"}},"card":{"summary":"Card","value":{"method":"CARD","amount":14990,"customerId":"cust_01example","installments":3}},"crypto":{"summary":"Crypto","value":{"method":"CRYPTO","amount":5000,"customerId":"cust_01example","asset":"USDT"}}}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"examples":{"pix":{"summary":"PIX transparent","value":{"data":{"id":"tran_01example","method":"PIX","amount":2500,"status":"PENDING","brCode":"00020126...Aporta","brCodeBase64":"data:image/png;base64,...","expiresAt":"2026-09-29T04:00:00.000Z","customerId":"cust_01example","devMode":true,"createdAt":"2026-09-29T03:00:00.000Z"},"success":true,"error":null}}}}}},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/transparents/simulate-dispute":{"post":{"tags":["Disputes"],"summary":"Sandbox stub: emit transparent.disputed","responses":{"200":{"description":"Event emitted"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/coupons/create":{"post":{"tags":["Coupons"],"summary":"Create coupon","responses":{"201":{"description":"Created"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/create":{"post":{"tags":["Subscriptions"],"summary":"Create subscription (legacy amount or items[] checkout)","responses":{"201":{"description":"Created"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/simulate-renewal":{"post":{"tags":["Subscriptions"],"summary":"Sandbox stub: emit subscription.renewed","responses":{"200":{"description":"Event emitted"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/simulate-trial":{"post":{"tags":["Subscriptions"],"summary":"Sandbox stub: emit subscription.trial_started","responses":{"200":{"description":"Event emitted"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webhooks/create":{"post":{"tags":["Webhooks"],"summary":"Register HTTPS webhook endpoint","description":"Deliveries signed with `X-Aporta-Signature: t=…,v1=…` (HMAC-SHA256 of `t.rawBody` with `whsec_…`).","responses":{"201":{"description":"Created with secret"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webhooks/events":{"get":{"tags":["Webhooks"],"summary":"List supported webhook event names","security":[],"responses":{"200":{"description":"Event catalog"}}}},"/v1/webhooks/list":{"get":{"tags":["Webhooks"],"summary":"List webhooks","responses":{"200":{"description":"Page"}}}},"/v1/payouts/create":{"post":{"tags":["Payouts"],"summary":"Create payout (PIX withdraw)","responses":{"201":{"description":"Created"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/pix/send/create":{"post":{"tags":["PIX send"],"summary":"Send PIX (emits transfer.completed|failed)","description":"Takes `amount` from the store balance: checked and reserved under the store's lock, like payouts.","responses":{"201":{"description":"Created"},"400":{"description":"`INSUFFICIENT_BALANCE` (details: available, requested)"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/crypto/receive/create":{"post":{"tags":["Crypto"],"summary":"Create crypto receive address","responses":{"201":{"description":"Created"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/crypto/receive/simulate-payment":{"post":{"tags":["Crypto"],"summary":"Sandbox: mark crypto receive PAID (emits crypto.receive.completed)","responses":{"200":{"description":"Paid"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/crypto/send/create":{"post":{"tags":["Crypto"],"summary":"Send crypto (emits crypto.send.completed|failed)","description":"Takes `amount` (centavos BRL) from the store balance: checked and reserved under the store's lock, like payouts.","responses":{"201":{"description":"Created"},"400":{"description":"`INSUFFICIENT_BALANCE` (details: available, requested)"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/store/get":{"get":{"tags":["Store"],"summary":"Store profile + balance","responses":{"200":{"description":"Store"}}}},"/v1/store/statement/movements":{"get":{"tags":["Store"],"summary":"Ledger rows, newest first (paged)","description":"Every movement of the six ledger lists (checkouts, transparents, crypto receives: `amount` > 0; payouts, Pix sends, crypto sends: `amount` < 0, gross) merged newest first. Keyset pagination: pass `pagination.next` as `cursor`. Same `startDate`/`endDate`/`q` as the lists. Totals: `/v1/store/statement`.","parameters":[{"name":"startDate","in":"query","schema":{"type":"string","format":"date"}},{"name":"endDate","in":"query","schema":{"type":"string","format":"date"}},{"name":"cursor","in":"query","schema":{"type":"string"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":10}},{"name":"q","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"Page of movements"},"400":{"description":"Bad date or cursor"}}}},"/v1/store/statement":{"get":{"tags":["Store"],"summary":"Ledger movement in a period","description":"Totals over every record created between `startDate` and `endDate` (YYYY-MM-DD, São Paulo days, inclusive; omit both for all time): `in` = charges that were paid (checkouts, transparents, crypto receives; refunded ones included), `out` = transfers except FAILED at their gross `amount` (payouts with their fee, Pix sends, crypto sends) plus refunds, `net` = in − out, `breakdown` per kind. The balance (`/v1/store/get`) is the opening float + all-time `net`. Amounts in centavos.","parameters":[{"name":"startDate","in":"query","schema":{"type":"string","format":"date"}},{"name":"endDate","in":"query","schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Statement totals","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"object","required":["in","out","net","currency"],"properties":{"in":{"$ref":"#/components/schemas/CountAmount"},"out":{"$ref":"#/components/schemas/CountAmount"},"net":{"type":"integer"},"currency":{"type":"string","enum":["BRL"]}}},"success":{"const":true},"error":{"const":null}}}}}},"400":{"description":"`BAD_REQUEST` (bad date or startDate > endDate)"},"403":{"description":"`KEY_SCOPE_FORBIDDEN` with a customer-scoped key"}}}},"/v1/api-keys/create":{"post":{"tags":["API keys"],"summary":"Create API key (full secret once)","description":"Dashboard: requires FIDO step-up (`X-Aporta-Step-Up`). `live: true` needs a dashboard session (never an API key) and KYC approved. Via API key: needs `api-keys:write`, test keys only, and only permissions the calling key already holds (default: its own). Empty permissions grant nothing; `*` excludes `api-keys:*` and `kyc:*`. `allowedIps` applies to live keys only. Optional `customerId` creates an agent key locked to one customer: lists return only that customer's records; other customers' records answer 404; creates force that customer (a different `customerId` is 403 `CUSTOMER_SCOPE_MISMATCH`); account-wide routes (store/balance, payouts, webhooks, API keys, Pix/crypto send, payment links, coupons, customer create/delete, product writes) answer 403 `KEY_SCOPE_FORBIDDEN`. Allowed: customers get/list/update (own), checkouts, transparents, subscriptions, products read, fees. The customer must exist in the key's environment (sk_test_ → sandbox, sk_live_ → production), else 400 `CUSTOMER_NOT_FOUND`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","maxLength":120},"live":{"type":"boolean","default":false},"permissions":{"type":"array","items":{"type":"string"},"description":"Default: [\"*\"] from the dashboard; the calling key's own permissions via API key."},"allowedIps":{"type":"array","items":{"type":"string"},"description":"Live keys only. Empty = any IP."},"customerId":{"type":"string","description":"Lock the key to this customer (agent / MCP key)."}}}}}},"responses":{"201":{"description":"Created. `data.key` is the full secret, shown once; `data.customerId` is the scope or null."},"400":{"description":"`CUSTOMER_NOT_FOUND` or invalid IPs"},"403":{"description":"`STEP_UP_REQUIRED`, `FORBIDDEN` (live without KYC) or `KEY_SCOPE_FORBIDDEN` (called with a scoped key)"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/api-keys/list":{"get":{"tags":["API keys"],"summary":"List API keys (masked)","description":"Each key carries `customerId` (scope) or null for store-wide keys.","responses":{"200":{"description":"Keys"},"403":{"description":"`KEY_SCOPE_FORBIDDEN` with a scoped key"}}}},"/v1/api-keys/revoke":{"post":{"tags":["API keys"],"summary":"Revoke API key","description":"Dashboard: requires FIDO step-up. Not available to customer-scoped keys.","responses":{"200":{"description":"Revoked"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/auth/register":{"post":{"tags":["Auth"],"summary":"Register merchant","security":[],"description":"Same answer for new and existing e-mails; the confirmation link is e-mailed. `termsVersion` must be the current legal version (Termos + Privacidade); otherwise 400 TERMS_NOT_ACCEPTED.","responses":{"202":{"description":"Accepted"},"400":{"description":"Invalid e-mail or terms not accepted"}}}},"/v1/webauthn/register/options":{"post":{"tags":["Auth"],"summary":"Start registering a security key or passkey","description":"Dashboard session only (security keys / passkeys, step-up for sensitive actions). Not available with API keys.","responses":{"200":{"description":"WebAuthn creation options"},"401":{"description":"No session"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webauthn/register/verify":{"post":{"tags":["Auth"],"summary":"Finish registering a security key or passkey","description":"Dashboard session only (security keys / passkeys, step-up for sensitive actions). Not available with API keys.","responses":{"200":{"description":"Credential saved"},"400":{"description":"Invalid attestation"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webauthn/credentials":{"get":{"tags":["Auth"],"summary":"List the user's security keys and passkeys","description":"Dashboard session only (security keys / passkeys, step-up for sensitive actions). Not available with API keys.","responses":{"200":{"description":"Credentials (no key material)"}}}},"/v1/webauthn/credentials/delete":{"post":{"tags":["Auth"],"summary":"Remove a security key or passkey","description":"Dashboard session only (security keys / passkeys, step-up for sensitive actions). Not available with API keys.","responses":{"200":{"description":"Removed"},"403":{"description":"Step-up required"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webauthn/authenticate/options":{"post":{"tags":["Auth"],"summary":"Start a step-up confirmation","description":"Dashboard session only (security keys / passkeys, step-up for sensitive actions). Not available with API keys.","responses":{"200":{"description":"WebAuthn request options"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webauthn/authenticate/verify":{"post":{"tags":["Auth"],"summary":"Finish a step-up confirmation","description":"Dashboard session only (security keys / passkeys, step-up for sensitive actions). Not available with API keys.","responses":{"200":{"description":"Step-up token"},"400":{"description":"Invalid assertion"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/me/deletion-request":{"post":{"tags":["Auth"],"summary":"Request deletion of the signed-in user's account (LGPD)","description":"Dashboard session only; confirmed with the password. Ops completes it within 15 days; retained records follow the legal retention.","responses":{"200":{"description":"Request recorded"},"403":{"description":"Wrong password"}}}},"/v1/auth/registration":{"get":{"tags":["Auth"],"summary":"Whether public sign-up is open (auth.public_registration flag)","security":[],"responses":{"200":{"description":"{ open: boolean }"}}}},"/v1/auth/login":{"post":{"tags":["Auth"],"summary":"Login merchant","security":[],"responses":{"200":{"description":"Session"}}}},"/v1/auth/forgot-password":{"post":{"tags":["Auth"],"summary":"Request a password reset link","security":[],"description":"Same answer whether or not the account exists. The link is emailed in the background (Resend). `delivered` is true when a real mailer is configured, not a per-account signal.","responses":{"200":{"description":"Accepted. Token is not returned in production."}}}},"/v1/auth/reset-password":{"post":{"tags":["Auth"],"summary":"Reset password with a single-use token","security":[],"responses":{"200":{"description":"Password updated"}}}},"/v1/customers/export":{"post":{"tags":["Customers"],"summary":"Export everything held about a customer (LGPD)","description":"JSON with the customer, its checkouts, transparent charges and subscriptions in this env. Dashboard: owner/admin + FIDO step-up. Not available to customer-scoped keys. Audited.","responses":{"200":{"description":"Export"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/customers/anonymize":{"post":{"tags":["Customers"],"summary":"Anonymize a customer (LGPD)","description":"Removes name, e-mail, phone, tax id, zip, metadata and externalId (also the payer copy on transparent charges); transactions are kept (legal retention). Production keeps a SHA-256 of the tax id. Idempotent. Dashboard: owner/admin + FIDO step-up. Audited.","responses":{"200":{"description":"Anonymized"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/receipts/{id}":{"get":{"tags":["Receipts"],"summary":"Public receipt (sandbox or live)","description":"No auth: the id is the capability. Found by id in the sandbox database, then in production; `devMode: false` marks a live receipt.","security":[],"responses":{"200":{"description":"Receipt"},"404":{"description":"Not found"}}}},"/v1/kyc/applications":{"post":{"tags":["KYC"],"summary":"Start a KYC application (company + representative); it starts in progress (status `draft`)","description":"Creates the application with status `draft`. Attach files (`/files` or `/documents`), then `POST /submit`. Statuses: draft → submitted → in_review → approved | rejected | needs_info (fix and submit again). Only the Aporta team decides; approval unlocks production for the store.","responses":{"201":{"description":"Application (status `draft`, in progress)"},"400":{"description":"Invalid CNPJ (check digits) / CPF"},"409":{"description":"`CONFLICT`: an open or approved application exists; `CNPJ_UNAVAILABLE`: this CNPJ can't be used"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/stores/get":{"get":{"tags":["Store"],"summary":"Current store (alias of /v1/store/get)","responses":{"200":{"description":"OK"}}}},"/v1/store":{"get":{"tags":["Store"],"summary":"Store profile + balance (alias of /v1/store/get)","responses":{"200":{"description":"OK"}}}},"/v1/customers/update":{"post":{"tags":["Customers"],"summary":"Update customer","description":"O e-mail é único por loja (sem diferença de caixa ou espaços nas pontas): trocar para o e-mail de outro cliente da loja responde 409 `CUSTOMER_EMAIL_TAKEN` (details.customerId) e não altera nada.","responses":{"200":{"description":"Customer"},"404":{"description":"Not found"},"409":{"description":"`CUSTOMER_EMAIL_TAKEN`: another customer of the store has this e-mail; or `IDEMPOTENCY_KEY_IN_USE`"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/products/{id}":{"get":{"tags":["Products"],"summary":"Get product","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Product"},"404":{"description":"Not found"}}}},"/v1/products/update":{"post":{"tags":["Products"],"summary":"Update product","responses":{"200":{"description":"Product"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/products/delete":{"post":{"tags":["Products"],"summary":"Delete product","responses":{"200":{"description":"Deleted"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/transparents/list":{"get":{"tags":["Transparents"],"summary":"List transparent charges","responses":{"200":{"description":"Page"}}}},"/v1/transparents/check":{"get":{"tags":["Transparents"],"summary":"Transparent charge status (`?id=`)","responses":{"200":{"description":"Status"},"404":{"description":"Not found"}}}},"/v1/transparents/simulate-payment":{"post":{"tags":["Transparents"],"summary":"Sandbox: mark transparent charge PAID","responses":{"200":{"description":"Paid"},"403":{"description":"`SANDBOX_ONLY` in production"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/transparents/refund":{"post":{"tags":["Transparents"],"summary":"Refund a paid transparent charge (emits transparent.refunded)","responses":{"200":{"description":"Refunded"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"403":{"description":"`STEP_UP_REQUIRED` (dashboard session without a fresh security-key assertion)"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/checkouts/resend-webhook":{"post":{"tags":["Checkouts"],"summary":"Emit the checkout's current status webhook again","responses":{"200":{"description":"Emitted"},"403":{"description":"`STEP_UP_REQUIRED` (dashboard session without a fresh security-key assertion)"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/payment-links/list":{"get":{"tags":["Payment links"],"summary":"List payment links","responses":{"200":{"description":"Page"}}}},"/v1/payment-links/one":{"get":{"tags":["Payment links"],"summary":"Get payment link (`?id=`)","responses":{"200":{"description":"Payment link"},"404":{"description":"Not found"}}}},"/v1/payment-links/update":{"post":{"tags":["Payment links"],"summary":"Update payment link","responses":{"200":{"description":"Payment link"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/payment-links/refund":{"post":{"tags":["Payment links"],"summary":"Refund (PAID) or cancel (ACTIVE) a payment link","responses":{"200":{"description":"Payment link"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/payment-links/delete":{"post":{"tags":["Payment links"],"summary":"Delete payment link","responses":{"200":{"description":"Deleted"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/coupons/list":{"get":{"tags":["Coupons"],"summary":"List coupons","responses":{"200":{"description":"Page"}}}},"/v1/coupons/{id}":{"get":{"tags":["Coupons"],"summary":"Get coupon","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Coupon"},"404":{"description":"Not found"}}}},"/v1/coupons/update":{"post":{"tags":["Coupons"],"summary":"Update coupon","responses":{"200":{"description":"Coupon"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/coupons/toggle":{"post":{"tags":["Coupons"],"summary":"Switch coupon active/inactive","responses":{"200":{"description":"Coupon"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/coupons/delete":{"post":{"tags":["Coupons"],"summary":"Delete coupon","responses":{"200":{"description":"Deleted"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/list":{"get":{"tags":["Subscriptions"],"summary":"List subscriptions","responses":{"200":{"description":"Page"}}}},"/v1/subscriptions/get":{"get":{"tags":["Subscriptions"],"summary":"Get subscription (`?id=`)","responses":{"200":{"description":"Subscription"},"404":{"description":"Not found"}}}},"/v1/subscriptions/{id}":{"get":{"tags":["Subscriptions"],"summary":"Get subscription","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Subscription"},"404":{"description":"Not found"}}}},"/v1/subscriptions/checkouts/list":{"get":{"tags":["Subscriptions"],"summary":"List checkouts (subscription view)","responses":{"200":{"description":"Page"}}}},"/v1/subscriptions/checkouts/one":{"get":{"tags":["Subscriptions"],"summary":"Get checkout (`?id=`, subscription view)","responses":{"200":{"description":"Checkout"},"404":{"description":"Not found"}}}},"/v1/subscriptions/checkouts/delete":{"post":{"tags":["Subscriptions"],"summary":"Delete a pending subscription checkout","responses":{"200":{"description":"Deleted"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/cancel":{"post":{"tags":["Subscriptions"],"summary":"Cancel subscription (emits subscription.cancelled)","responses":{"200":{"description":"Subscription"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/change-plan":{"post":{"tags":["Subscriptions"],"summary":"Schedule a plan change for the next renewal","responses":{"200":{"description":"Subscription"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`PRODUCT_NO_CYCLE`"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/subscriptions/record-usage":{"post":{"tags":["Subscriptions"],"summary":"Record metered usage","responses":{"200":{"description":"Subscription"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webhooks/{id}":{"get":{"tags":["Webhooks"],"summary":"Get webhook (secret not included)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Webhook"},"404":{"description":"Not found"}}}},"/v1/webhooks/{id}/deliveries":{"get":{"tags":["Webhooks"],"summary":"Delivery log of one webhook","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Page"},"404":{"description":"Not found"}}}},"/v1/webhooks/deliveries":{"get":{"tags":["Webhooks"],"summary":"Delivery log (`?webhookId=`, `?status=pending|success|failed`)","responses":{"200":{"description":"Page"}}}},"/v1/webhooks/update":{"post":{"tags":["Webhooks"],"summary":"Update webhook","responses":{"200":{"description":"Webhook"},"400":{"description":"`BAD_REQUEST` / `INVALID_STATE`"},"403":{"description":"`STEP_UP_REQUIRED` (dashboard session without a fresh security-key assertion)"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webhooks/rotate-secret":{"post":{"tags":["Webhooks"],"summary":"Rotate signing secret (new `whsec_…` returned once)","responses":{"200":{"description":"Webhook with secret"},"403":{"description":"`STEP_UP_REQUIRED` (dashboard session without a fresh security-key assertion)"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webhooks/redeliver":{"post":{"tags":["Webhooks"],"summary":"Queue a delivery again","responses":{"200":{"description":"Delivery"},"403":{"description":"`STEP_UP_REQUIRED` (dashboard session without a fresh security-key assertion)"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/webhooks/delete":{"post":{"tags":["Webhooks"],"summary":"Delete webhook","responses":{"200":{"description":"Deleted"},"403":{"description":"`STEP_UP_REQUIRED` (dashboard session without a fresh security-key assertion)"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}},"parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}]}},"/v1/payouts/list":{"get":{"tags":["Payouts"],"summary":"List payouts","responses":{"200":{"description":"Page"}}}},"/v1/payouts/{id}":{"get":{"tags":["Payouts"],"summary":"Get payout","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Payout"},"404":{"description":"Not found"}}}},"/v1/pix/send/list":{"get":{"tags":["PIX send"],"summary":"List Pix transfers","responses":{"200":{"description":"Page"}}}},"/v1/pix/send/{id}":{"get":{"tags":["PIX send"],"summary":"Get Pix transfer","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Pix transfer"},"404":{"description":"Not found"}}}},"/v1/crypto/receive/list":{"get":{"tags":["Crypto"],"summary":"List crypto receives","responses":{"200":{"description":"Page"}}}},"/v1/crypto/receive/{id}":{"get":{"tags":["Crypto"],"summary":"Get crypto receive","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Crypto receive"},"404":{"description":"Not found"}}}},"/v1/crypto/send/list":{"get":{"tags":["Crypto"],"summary":"List crypto sends","responses":{"200":{"description":"Page"}}}},"/v1/crypto/send/{id}":{"get":{"tags":["Crypto"],"summary":"Get crypto send","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Crypto send"},"404":{"description":"Not found"}}}},"/v1/auth/verify-email":{"post":{"tags":["Auth"],"summary":"Confirm e-mail with the link token","security":[],"responses":{"200":{"description":"Verified"},"400":{"description":"Invalid or expired token"}}}},"/v1/auth/logout":{"post":{"tags":["Auth"],"summary":"Revoke the current session","responses":{"200":{"description":"Logged out"}}}},"/v1/auth/me":{"get":{"tags":["Auth"],"summary":"Current dashboard user and store","responses":{"200":{"description":"Session user"},"401":{"description":"No valid session"}}}},"/v1/flags":{"get":{"tags":["Auth"],"summary":"Feature flags visible to the dashboard","description":"Dashboard session only. Client-visible flags evaluated for the store (`X-Aporta-Store`) and env (`X-Aporta-Env`): `{ env, flags: { [key]: boolean } }`. Server-only flags are never listed. Cached ~15 s.","responses":{"200":{"description":"`{ env, flags }`"},"401":{"description":"No session"}}}},"/v1/me/stores":{"get":{"tags":["Stores & members"],"summary":"Stores the signed-in user belongs to (dashboard store switcher)","description":"Dashboard session only. Each store with the caller's role (`owner`, `admin`, `developer`, `viewer`), whether production is unlocked and whether it is archived. `lastStoreId` is the default for a bare `/dashboard`.","responses":{"200":{"description":"`{ stores: StoreSummary[], lastStoreId }`"},"401":{"description":"No session"}}}},"/v1/me/stores/create":{"post":{"tags":["Stores & members"],"summary":"Create a store (caller becomes owner)","description":"Needs a verified e-mail; the shared demo account can't create stores. No fixed limit per user, but rate limited per user and per IP (429 with Retry-After). The new store starts empty and sandbox-only (no KYC); production unlocks when the Aporta team approves its KYC.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":2,"maxLength":60}}}}}},"responses":{"201":{"description":"StoreSummary"},"403":{"description":"`EMAIL_NOT_VERIFIED` / demo"},"429":{"description":"Rate limited"}}}},"/v1/me/stores/switch":{"post":{"tags":["Stores & members"],"summary":"Remember a store as the user's default","description":"Only the default for the next login or a bare `/dashboard`: every dashboard request still names its store with `X-Aporta-Store`, validated against the caller's active membership. 403 when not a member.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["store"],"properties":{"store":{"type":"string","description":"Store id or slug"}}}}}},"responses":{"200":{"description":"StoreSummary"},"403":{"description":"Not a member"}}}},"/v1/invitations/accept":{"post":{"tags":["Stores & members"],"summary":"Accept a store invitation","description":"Logged in with the invited, verified e-mail. Single use, expires in 7 days. Unknown, used, expired, revoked or another e-mail's token all answer the same 400 `INVITATION_INVALID`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}},"responses":{"200":{"description":"StoreSummary"},"400":{"description":"`INVITATION_INVALID`"}}}},"/v1/store/members":{"get":{"tags":["Stores & members"],"summary":"Members and open invitations of the store (owner/admin)","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"responses":{"200":{"description":"`{ you, members, invitations }`"},"403":{"description":"`ROLE_FORBIDDEN`"},"404":{"description":"`STORE_NOT_FOUND`"}}}},"/v1/store/invitations":{"post":{"tags":["Stores & members"],"summary":"Invite someone by e-mail (owner/admin)","description":"Admins can't invite owners. Inviting an `owner` or `admin` needs FIDO step-up (`members.invite_privileged`, target = the e-mail). Rate limited per store and per user. One open invitation per e-mail per store (a new one replaces it).","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","role"],"properties":{"email":{"type":"string"},"role":{"type":"string","enum":["owner","admin","developer","viewer"]}}}}}},"responses":{"201":{"description":"Invitation"},"403":{"description":"`ROLE_FORBIDDEN` / `STEP_UP_REQUIRED`"},"429":{"description":"Rate limited"}}}},"/v1/store/invitations/revoke":{"post":{"tags":["Stores & members"],"summary":"Cancel an open invitation (owner/admin)","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["id"],"properties":{"id":{"type":"string"}}}}}},"responses":{"200":{"description":"Revoked"},"404":{"description":"Not found"}}}},"/v1/store/members/role":{"post":{"tags":["Stores & members"],"summary":"Change a member's role (owner/admin, step-up)","description":"FIDO step-up `members.role` (target = userId). Admins never create, demote or edit owners. The last owner can't be demoted (409 `LAST_OWNER`).","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId","role"],"properties":{"userId":{"type":"string"},"role":{"type":"string","enum":["owner","admin","developer","viewer"]}}}}}},"responses":{"200":{"description":"Changed"},"403":{"description":"`ROLE_FORBIDDEN` / `STEP_UP_REQUIRED`"},"409":{"description":"`LAST_OWNER`"}}}},"/v1/store/members/remove":{"post":{"tags":["Stores & members"],"summary":"Remove a member (owner/admin, step-up)","description":"FIDO step-up `members.remove` (target = userId). Access ends on that member's next request; their pending step-ups for this store are dropped. The last owner can't leave.","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId"],"properties":{"userId":{"type":"string"}}}}}},"responses":{"200":{"description":"Removed"},"403":{"description":"`ROLE_FORBIDDEN` / `STEP_UP_REQUIRED`"},"409":{"description":"`LAST_OWNER`"}}}},"/v1/store/transfer":{"post":{"tags":["Stores & members"],"summary":"Transfer ownership to another member (owner, step-up)","description":"The target becomes owner and the caller becomes admin. Step-up `store.transfer` (target = userId).","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["userId"],"properties":{"userId":{"type":"string"}}}}}},"responses":{"200":{"description":"Transferred"},"403":{"description":"`ROLE_FORBIDDEN` / `STEP_UP_REQUIRED`"}}}},"/v1/store/audit":{"get":{"tags":["Stores & members"],"summary":"Store activity log (owner/admin)","description":"Append-only: who, what, target, IP and time, newest first, keyset-paged (`cursor` from `pagination.next`).","parameters":[{"$ref":"#/components/parameters/StoreHeader"},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Audit events page"},"403":{"description":"`ROLE_FORBIDDEN`"}}}},"/v1/store/settings":{"post":{"tags":["Stores & members"],"summary":"Rename the store (owner/admin)","description":"Only the name changes; the slug (used in dashboard URLs) is immutable, so links stay valid.","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string","minLength":2,"maxLength":60}}}}}},"responses":{"200":{"description":"Store"}}}},"/v1/store/archive":{"post":{"tags":["Stores & members"],"summary":"Archive the store (owner, step-up)","description":"Read-only from then on: every API key (sandbox and live) is revoked, writes answer 403 `STORE_ARCHIVED`, digests stop. Data stays available to the owner.","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"responses":{"200":{"description":"Archived"},"403":{"description":"`ROLE_FORBIDDEN` / `STEP_UP_REQUIRED` / demo"}}}},"/v1/store/delete":{"post":{"tags":["Stores & members"],"summary":"Delete the store (owner, step-up)","description":"Refused (409 `STORE_HAS_BALANCE`) while the store has a production balance: archive instead. Deleted stores disappear from every list; rows are kept (financial records and the audit log).","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"responses":{"200":{"description":"Deleted"},"409":{"description":"`STORE_HAS_BALANCE`"}}}},"/v1/store/onboarding":{"get":{"tags":["Stores & members"],"summary":"Onboarding checklist of the store","parameters":[{"$ref":"#/components/parameters/StoreHeader"}],"responses":{"200":{"description":"`{ sandboxKey, firstCheckout, webhook, kycStatus, productionEnabled, canSubmitKyc }`"}}}},"/v1/kyc/applications/me":{"get":{"tags":["KYC"],"summary":"Latest KYC application of this store","responses":{"200":{"description":"Application or null"}}}},"/v1/kyc/applications/{id}/files":{"post":{"tags":["KYC"],"summary":"Upload a KYC file (raw bytes)","description":"`Content-Type: application/octet-stream`, the file as the body. PDF, JPG or PNG (checked by content, not name), up to 8 MB, 10 files per application. Stored in a private bucket; only the Aporta team can view it.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"name":"type","in":"query","required":true,"schema":{"type":"string","enum":["contrato_social","cartao_cnpj","documento_representante","comprovante_endereco","outro"]}},{"name":"fileName","in":"query","required":false,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Application"},"400":{"description":"`UNSUPPORTED_FILE` / empty / limit"},"404":{"description":"Not found"},"409":{"description":"Application no longer accepts files"},"413":{"description":"File over 8 MB"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"},"503":{"description":"`STORAGE_UNAVAILABLE`"}}}},"/v1/kyc/applications/{id}/documents":{"post":{"tags":["KYC"],"summary":"Attach a KYC file as base64 (small files)","description":"JSON `{ type, fileName?, dataBase64 }`, same checks as `/files`. Links (`url`) are not accepted.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"201":{"description":"Application"},"400":{"description":"`BAD_REQUEST` / `UNSUPPORTED_FILE`"},"404":{"description":"Not found"},"409":{"description":"Application no longer accepts files"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}}}},"/v1/kyc/applications/{id}/submit":{"post":{"tags":["KYC"],"summary":"Send the application for review (draft or needs_info → submitted)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Application"},"400":{"description":"No file attached"},"404":{"description":"Not found"},"409":{"description":"Wrong status / `CNPJ_UNAVAILABLE`"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}}}},"/v1/kyc/applications/{id}/simulate":{"post":{"tags":["KYC"],"summary":"Sandbox: approve or reject a KYC application","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}},{"$ref":"#/components/parameters/IdempotencyKey"}],"responses":{"200":{"description":"Application"},"403":{"description":"Not available on this deployment"},"404":{"description":"Not found"},"409":{"description":"`IDEMPOTENCY_KEY_IN_USE`: a request with this key is still running (Retry-After)"},"422":{"description":"`IDEMPOTENCY_KEY_REUSED`: this key was used with a different request"}}}}}}