> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentaos.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Set the approved sites

> Replaces the business's approved sites with `embedDomains`: send every site each time, and an empty list to remove them all. Each entry is reduced to its origin (`https://host`, with a port if you give one): a path, query or trailing `/` is dropped, and duplicates are removed. Needs a live key, and the key's owner must be an owner or admin of the business. At most 5 saves per minute.

> [!WARNING]
>
> Needs a live key (`sk_live_...`): approved sites are a live setting. A test key gets `403 live_key_required`. The key's owner must be an owner or admin of the business.

> [!NOTE]
>
> The list you send replaces the saved list. Send every site each time; an empty list removes them all. This is the same list as **Settings → Developers → Approved sites** in the dashboard. See [Embedded checkout](https://docs.agentaos.ai/payments/embedded-checkout.md).

> [!NOTE]
>
> **For a platform:** to set the sites of a business you manage, put its id in the path **and** in the [`AgentaOS-Account` header](https://docs.agentaos.ai/api-reference/introduction#acting-for-a-business). The two must match, or the call returns `403 You cannot act as this business.`

> [!NOTE]
>
> **Webhook:** none.


## OpenAPI

````yaml PATCH /orgs/{id}/embed-domains
openapi: 3.1.0
info:
  title: AgentaOS Gateway API
  version: 1.0.0
  description: >-
    The AgentaOS REST API: payment links, checkouts, subscriptions, customers,
    invoices, and the unified transactions feed. This is the same API the
    TypeScript SDK (`@agentaos/pay`) and the `agenta` CLI call underneath.


    ## Money model


    - **Decimal currency units (`number`)**: a plain `amount` field (on a create
    body, a Payment Link, a Checkout's `amount_override`, or an Invoice's
    `amount`/`fiat_amount`/`tax_amount`) is in currency units. `49.99` means EUR
    49.99, never cents.

    - **Integer minor units (`number`)**: exactly one field breaks that rule:
    `unitAmountMinor` on a Subscription. It is an integer count of the smallest
    currency unit (`1999` means EUR 19.99), named with a `Minor` suffix
    specifically so it is never confused with a plain `amount`. The `money`
    object on Transactions and the `earnings` object on a retrieved Invoice are
    also integer minor units, computed server-side.

    - **String, on webhooks**: the `amount` inside a webhook payload's `data`
    object is a string (e.g. `"49.99"`), since JSON numbers silently drop
    trailing zeros and this value must round-trip exactly for accounting.


    ## Naming convention


    Most response fields mirror the underlying database column and are
    `snake_case` (`created_at`, `seller_mode`, `buyer_email`, ...). A small
    number of computed convenience fields are camelCase with no snake_case
    equivalent: `checkoutUrl` on Checkouts and Payment Links, `sellerMode` on
    Payment Links specifically, `money` on Transactions, and `earnings` on a
    single retrieved Invoice. Two resources (Subscriptions and Customers) are
    fully camelCase end to end.


    ## Pagination


    Every list endpoint takes `limit` and `offset` and returns `{ items, total,
    hasMore }`. `hasMore` is computed server-side (`offset + items.length <
    total`); never derive it client-side.
  contact:
    name: AgentaOS
    url: https://agentaos.ai
  license:
    name: Proprietary
    url: https://agentaos.ai
servers:
  - url: https://api.agentaos.ai/api/v1
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Payment Links
    description: >-
      Reusable, shareable payment products: a fixed amount and description
      behind one URL.
  - name: Checkouts
    description: >-
      One attempt to collect one payment, standalone or built from a payment
      link. Wire path is `/gateway/sessions`; the SDK and CLI call this resource
      "checkout".
  - name: Subscriptions
    description: >-
      Merchant-side read and management surface for recurring plans. Created
      automatically when a buyer pays a `type: subscription` payment link.
  - name: Customers
    description: 'Read-only surface: everyone who has paid you or been sent an invoice.'
  - name: Invoices
    description: >-
      Every checkout issues an invoice. List, retrieve, void, export, and
      download PDFs/receipts.
  - name: Transactions
    description: >-
      The unified activity feed: every inbound payment and outbound send, across
      every rail, in one list.
  - name: Discount Codes
    description: >-
      Codes a buyer types at checkout on a subscription plan. The code string is
      yours, so two merchants can both run SAVE20. A code may also carry no
      discount at all, so you can see who a referral brought in without giving
      money away. Terms are fixed once created: to change them, archive the code
      and create another.
  - name: Businesses
    description: >-
      For platforms: the businesses you manage, a client's business or another
      app of your own company. To act as one of them on any other endpoint, send
      its id in the `AgentaOS-Account` header. Every field on this resource is
      camelCase on the wire.
  - name: Bank Accounts
    description: >-
      Where payouts go: the bank accounts of a business, as thin references
      (holder, last four digits, the name-check result), never the account
      number. For a platform: with the `AgentaOS-Account` header these act on a
      business you manage, once we have opened bank accounts by API for your
      platform. Adding an account needs a live key.
  - name: Approved sites
    description: The sites allowed to show a business's embedded checkout.
  - name: Payouts
    description: A business's payouts and the two documents that come with each one.
paths:
  /orgs/{id}/embed-domains:
    patch:
      tags:
        - Approved sites
      summary: Set the approved sites
      description: >-
        Replaces the business's approved sites with `embedDomains`: send every
        site each time, and an empty list to remove them all. Each entry is
        reduced to its origin (`https://host`, with a port if you give one): a
        path, query or trailing `/` is dropped, and duplicates are removed.
        Needs a live key, and the key's owner must be an owner or admin of the
        business. At most 5 saves per minute.
      operationId: updateApprovedSites
      parameters:
        - $ref: '#/components/parameters/BusinessId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovedSites'
            example:
              embedDomains:
                - https://acme.com
                - https://shop.acme.com
      responses:
        '200':
          description: The saved list, as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovedSites'
              example:
                embedDomains:
                  - https://acme.com
                  - https://shop.acme.com
        '400':
          description: >-
            An entry is not an `https://` address on a public name (no IP
            address, IPv6 included, no `localhost`, `.local`, `.internal`, `*`
            or `user@`), or the list has more than 10 entries.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_a_site:
                  value:
                    statusCode: 400
                    message: >-
                      acme.com isn't a site address we can approve. Use the
                      address from the browser bar, like https://acme.com.
                    timestamp: '2026-10-31T12:00:00.000Z'
                not_public:
                  value:
                    statusCode: 400
                    message: >-
                      Embed domain must be a public HTTPS origin:
                      https://localhost
                    timestamp: '2026-10-31T12:00:00.000Z'
                too_many:
                  value:
                    statusCode: 400
                    message:
                      - embedDomains must contain no more than 10 elements
                    error: Bad Request
                    timestamp: '2026-10-31T12:00:00.000Z'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            A test key, a business you do not manage, or (signed in) a member
            who is not an owner or admin. An API key whose creator is no longer
            an owner or admin is refused earlier, with 401
            `key_no_longer_valid`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                live_key_required:
                  value:
                    statusCode: 403
                    code: live_key_required
                    message: >-
                      This needs a live API key: it changes real money, live
                      settings or a real identity check. This is a test key.
                    timestamp: '2026-10-31T12:00:00.000Z'
                not_yours:
                  value:
                    statusCode: 403
                    message: You cannot act as this business.
                    timestamp: '2026-10-31T12:00:00.000Z'
                role:
                  value:
                    statusCode: 403
                    message: 'Requires role: owner or admin'
                    timestamp: '2026-10-31T12:00:00.000Z'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    BusinessId:
      name: id
      in: path
      required: true
      description: The business UUID.
      schema:
        type: string
        format: uuid
  schemas:
    ApprovedSites:
      type: object
      required:
        - embedDomains
      properties:
        embedDomains:
          type: array
          maxItems: 10
          items:
            type: string
          description: >-
            Every site the business approves, as `https://` addresses. This list
            replaces the saved list.
    Error:
      type: object
      description: >-
        Every non-2xx response is JSON in this shape. Every response (success or
        error) also carries an `x-request-id` response header; send that header
        on your request to have your own id echoed back, otherwise the server
        mints one. On errors the same id is repeated in the `requestId` body
        field.
      properties:
        statusCode:
          type: integer
          description: Same as the HTTP status code.
        code:
          type: string
          description: >-
            Present on some refusals: a stable machine-readable reason, e.g.
            `live_key_required`.
        message:
          description: >-
            Human-readable. A validation failure (400) returns an array of
            per-field messages instead of one string.
          anyOf:
            - type: string
            - type: array
              items:
                type: string
        errors:
          type: array
          description: >-
            Present on 400 validation failures: one entry per invalid field. The
            flat human-readable strings stay in `message` for back-compat; this
            is the machine-readable, per-field view.
          items:
            type: object
            properties:
              field:
                type: string
                description: >-
                  Name of the invalid field, dot-notated for nested properties
                  (e.g. `checkoutFields.0.type`).
              message:
                type: string
                description: Validation messages for that field, joined with `, `.
            required:
              - field
              - message
        requestId:
          type: string
          description: >-
            Correlation id, identical to the `x-request-id` response header.
            Include it when contacting support. On success it is available on
            the header only, not the body.
        timestamp:
          type: string
          format: date-time
        error:
          type: string
          description: >-
            The HTTP status name, for example `Bad Request`. Present on most
            errors.
      required:
        - statusCode
        - message
        - timestamp
  responses:
    Unauthorized:
      description: Missing or invalid `x-api-key`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Invalid API key
            timestamp: '2026-08-06T12:00:00.000Z'
    TooManyRequests:
      description: >-
        Too many requests: at most 60 a minute to one route from one IP address,
        and fewer on some routes (the route says so). Wait a minute, then retry.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 429
            message: Too many tries in a row. Wait a minute, then try again.
            timestamp: '2026-10-31T12:00:00.000Z'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your secret key, from app.agentaos.ai -> Settings -> Developers -> API
        Keys. The key's prefix is both its identity and its environment:
        `sk_test_...` (sandbox, free, no verification) or `sk_live_...` (real
        money, requires business verification). A missing or invalid key returns
        401.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.