components:
  responses:
    SedraBadRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SedraError'
      description: Invalid input
    SedraConflict:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SedraError'
      description: Invalid state or replayed request
    SedraForbidden:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SedraError'
      description: Authenticated but not allowed
    SedraNotFound:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SedraError'
      description: Not found (also returned for items that belong to another business)
    SedraRateLimited:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SedraError'
      description: Too many requests
    SedraUnauthorized:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/SedraError'
      description: Missing, invalid, expired or revoked credentials
  schemas:
    InvokeResult:
      properties:
        approval_id:
          type: string
        capability:
          type: string
        data: {}
        error:
          properties:
            code:
              type: string
            details: {}
            message:
              type: string
          type: object
        meta:
          type: object
        ok:
          type: boolean
        status:
          enum:
            - success
            - dry_run
            - pending_approval
            - replayed
            - error
        tenant_id:
          type:
            - string
            - 'null'
      type: object
    SedraError:
      description: Every Sedra error has this shape.
      example:
        error:
          code: forbidden
          message: Missing scope catalog:write
        ok: false
        status: error
      properties:
        error:
          $ref: '#/components/schemas/SedraErrorBody'
        ok:
          const: false
          type: boolean
        status:
          const: error
          type: string
      required:
        - ok
        - status
        - error
      type: object
    SedraErrorBody:
      properties:
        code:
          enum:
            - unauthenticated
            - forbidden
            - tenant_forbidden
            - tenant_required
            - invalid_input
            - not_found
            - rate_limited
            - idempotency_key_required
            - idempotency_conflict
            - conflict
            - internal
          type: string
        details:
          description: Extra context, e.g. field errors for invalid_input or retry_after_ms for rate_limited
        message:
          type: string
      required:
        - code
        - message
      type: object
  securitySchemes:
    sedra_api_key:
      description: >-
        Sedra API credential: `sdr_ai_…` (AI assistants) or `sdr_int_…` (integrations). Legacy `fos_` credentials remain
        valid.
      scheme: bearer
      type: http
info:
  description: >-
    Governed business operations for **merchant integrations and AI assistants** (the same operations power Sedra's MCP
    server). Every call is authorized by credential scope and business role, validated, rate-limited and audited. Writes
    need an `idempotency_key`; sensitive operations only create an approval request.
  title: Sedra Agent API
  version: 0.1.0
  x-sedra-source: https://api.sedra.one/foulad/openapi
openapi: 3.1.0
paths:
  /foulad/agent/invoke/approvals.list:
    post:
      description: >-
        Lists sensitive operations awaiting or after human approval for a business. Agents cannot approve; a human must
        decide in the Sedra app.
      operationId: approvals_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 20
                      maximum: 100
                      minimum: 1
                      type: integer
                    status:
                      enum:
                        - pending
                        - approved
                        - rejected
                        - executed
                        - failed
                        - expired
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List approval requests
      tags:
        - approvals
      x-sedra-action: read
      x-sedra-capability: approvals.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: approvals_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: operations:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.categories.create:
    post:
      description: Creates a product category in the selected business (optionally under a parent category of the same business).
      operationId: catalog_categories_create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    handle:
                      maxLength: 120
                      pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
                      type: string
                    name:
                      maxLength: 120
                      minLength: 1
                      type: string
                    name_ar:
                      maxLength: 120
                      type: string
                    parent_category_id:
                      type: string
                  required:
                    - name
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Create a category
      tags:
        - catalog
      x-sedra-action: write
      x-sedra-capability: catalog.categories.create
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_categories_create
      x-sedra-min-role: operator
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/catalog.categories.list:
    post:
      description: Lists the selected business's product categories.
      operationId: catalog_categories_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List categories
      tags:
        - catalog
      x-sedra-action: read
      x-sedra-capability: catalog.categories.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_categories_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.prices.bulk_update:
    post:
      description: >-
        Changes prices of many variants in the business currency. Sensitive: returns a before/after preview and requires
        human approval before applying.
      operationId: catalog_prices_bulk_update
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    changes:
                      items:
                        properties:
                          amount:
                            description: Amount in major units, e.g. 12.5 = 12.500 BHD
                            maximum: 1000000
                            minimum: 0
                            type: number
                          variant_id:
                            type: string
                        required:
                          - variant_id
                          - amount
                        type: object
                      maxItems: 500
                      minItems: 1
                      type: array
                  required:
                    - changes
                  type: object
                reason:
                  type: string
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Bulk-change variant prices (approval required)
      tags:
        - catalog
      x-sedra-action: sensitive
      x-sedra-capability: catalog.prices.bulk_update
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_prices_bulk_update
      x-sedra-min-role: manager
      x-sedra-requires-approval: true
      x-sedra-scope: catalog:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.products.create:
    post:
      description: >-
        Creates a product in the selected business with one or more variants priced in the business currency, attaches
        it to the business's sales channel and seeds stock at the business's stock locations. Supports dry_run. Defaults
        to draft.
      operationId: catalog_products_create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    category_ids:
                      default: []
                      items:
                        type: string
                      maxItems: 10
                      type: array
                    description:
                      maxLength: 5000
                      type: string
                    description_ar:
                      maxLength: 5000
                      type: string
                    handle:
                      maxLength: 120
                      pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
                      type: string
                    status:
                      default: draft
                      enum:
                        - draft
                        - published
                      type: string
                    thumbnail:
                      format: uri
                      type: string
                    title:
                      maxLength: 200
                      minLength: 1
                      type: string
                    title_ar:
                      description: Arabic title (stored in product metadata)
                      maxLength: 200
                      type: string
                    variants:
                      items:
                        properties:
                          initial_stock:
                            default: 0
                            maximum: 1000000
                            minimum: 0
                            type: integer
                          price:
                            description: Amount in major units, e.g. 12.5 = 12.500 BHD
                            maximum: 1000000
                            minimum: 0
                            type: number
                          sku:
                            maxLength: 64
                            type: string
                          title:
                            default: Default
                            maxLength: 100
                            minLength: 1
                            type: string
                        required:
                          - price
                        type: object
                      maxItems: 50
                      minItems: 1
                      type: array
                  required:
                    - title
                    - variants
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Create a product
      tags:
        - catalog
      x-sedra-action: write
      x-sedra-capability: catalog.products.create
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_products_create
      x-sedra-min-role: operator
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.products.delete:
    post:
      description: >-
        Deletes products from the selected business. Sensitive: creates an approval request that a human manager must
        approve before anything is deleted.
      operationId: catalog_products_delete
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    ids:
                      items:
                        type: string
                      maxItems: 50
                      minItems: 1
                      type: array
                  required:
                    - ids
                  type: object
                reason:
                  type: string
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Delete products (approval required)
      tags:
        - catalog
      x-sedra-action: sensitive
      x-sedra-capability: catalog.products.delete
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_products_delete
      x-sedra-min-role: manager
      x-sedra-requires-approval: true
      x-sedra-scope: catalog:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.products.get:
    post:
      description: Returns one product of the selected business by id or handle.
      operationId: catalog_products_get
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    handle:
                      maxLength: 120
                      pattern: ^[a-z0-9]+(?:-[a-z0-9]+)*$
                      type: string
                    id:
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Get a product
      tags:
        - catalog
      x-sedra-action: read
      x-sedra-capability: catalog.products.get
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_products_get
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.products.search:
    post:
      description: >-
        Searches the selected business's products by text (title/handle/description) and status. Returns variants, SKUs
        and prices. Only this business's products are visible.
      operationId: catalog_products_search
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 20
                      maximum: 100
                      minimum: 1
                      type: integer
                    offset:
                      default: 0
                      maximum: 9007199254740991
                      minimum: 0
                      type: integer
                    q:
                      maxLength: 200
                      type: string
                    status:
                      enum:
                        - draft
                        - proposed
                        - published
                        - rejected
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Search products
      tags:
        - catalog
      x-sedra-action: read
      x-sedra-capability: catalog.products.search
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_products_search
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/catalog.products.update:
    post:
      description: >-
        Updates title, description, Arabic texts, status (draft/published), thumbnail or categories of a product in the
        selected business. Prices are changed with catalog.prices.bulk_update.
      operationId: catalog_products_update
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    category_ids:
                      items:
                        type: string
                      maxItems: 10
                      type: array
                    description:
                      maxLength: 5000
                      type: string
                    description_ar:
                      maxLength: 5000
                      type: string
                    id:
                      type: string
                    status:
                      enum:
                        - draft
                        - published
                      type: string
                    thumbnail:
                      format: uri
                      type: string
                    title:
                      maxLength: 200
                      minLength: 1
                      type: string
                    title_ar:
                      maxLength: 200
                      type: string
                  required:
                    - id
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Update a product
      tags:
        - catalog
      x-sedra-action: write
      x-sedra-capability: catalog.products.update
      x-sedra-human-only: false
      x-sedra-mcp-tool: catalog_products_update
      x-sedra-min-role: operator
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/customers.list:
    post:
      description: >-
        Lists customers of the selected business. Emails and phone numbers are masked; addresses and payment data are
        never returned.
      operationId: customers_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 20
                      maximum: 100
                      minimum: 1
                      type: integer
                    offset:
                      default: 0
                      maximum: 9007199254740991
                      minimum: 0
                      type: integer
                    q:
                      maxLength: 100
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Review customers
      tags:
        - customers
      x-sedra-action: read
      x-sedra-capability: customers.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: customers_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: customers:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/devices.config.update:
    post:
      description: >-
        Updates non-safety business configuration of a device (display message, maintenance mode). Hardware control,
        dispensing and safety interlocks are NOT accessible. Supports dry_run.
      operationId: devices_config_update
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    device_id:
                      type: string
                    display_message:
                      additionalProperties: false
                      properties:
                        ar:
                          maxLength: 500
                          type: string
                        en:
                          maxLength: 500
                          type: string
                      type: object
                    maintenance_mode:
                      type: boolean
                  required:
                    - device_id
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Update device business configuration
      tags:
        - devices
      x-sedra-action: write
      x-sedra-capability: devices.config.update
      x-sedra-human-only: false
      x-sedra-mcp-tool: devices_config_update
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: inventory:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/devices.list:
    post:
      description: >-
        Lists the selected business's vending machines / kiosks with status, last-seen time and latest telemetry. Agents
        can read device state but can never actuate hardware.
      operationId: devices_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List physical devices
      tags:
        - devices
      x-sedra-action: read
      x-sedra-capability: devices.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: devices_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: operations:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/devices.vends.list:
    post:
      description: Lists recent vending transactions (paid, dispensed, failed, refund requested) for the business's devices.
      operationId: devices_vends_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 20
                      maximum: 100
                      minimum: 1
                      type: integer
                    status:
                      enum:
                        - created
                        - paid
                        - dispensed
                        - dispense_failed
                        - refund_requested
                        - refunded
                        - cancelled
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List vending transactions
      tags:
        - devices
      x-sedra-action: read
      x-sedra-capability: devices.vends.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: devices_vends_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: orders:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/inventory.levels.list:
    post:
      description: >-
        Lists stocked, reserved and available quantities per variant and stock location for the selected business.
        Optionally filter by product or a low-stock threshold.
      operationId: inventory_levels_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    low_stock_threshold:
                      maximum: 9007199254740991
                      minimum: 0
                      type: integer
                    product_id:
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Query inventory levels
      tags:
        - inventory
      x-sedra-action: read
      x-sedra-capability: inventory.levels.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: inventory_levels_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: inventory:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/inventory.levels.set:
    post:
      description: >-
        Sets the stocked quantity of a variant at one of the business's stock locations (absolute value, or a relative
        adjustment with `adjust_by`). Supports dry_run.
      operationId: inventory_levels_set
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    adjust_by:
                      maximum: 1000000
                      minimum: -1000000
                      type: integer
                    location_id:
                      type: string
                    note:
                      maxLength: 500
                      type: string
                    stocked_quantity:
                      maximum: 1000000
                      minimum: 0
                      type: integer
                    variant_id:
                      type: string
                  required:
                    - variant_id
                    - location_id
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Set stock quantity
      tags:
        - inventory
      x-sedra-action: write
      x-sedra-capability: inventory.levels.set
      x-sedra-human-only: false
      x-sedra-mcp-tool: inventory_levels_set
      x-sedra-min-role: operator
      x-sedra-requires-approval: false
      x-sedra-scope: inventory:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/inventory.stock_locations.list:
    post:
      description: Lists the selected business's stock locations (warehouses, shops, vending machines).
      operationId: inventory_stock_locations_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List stock locations
      tags:
        - inventory
      x-sedra-action: read
      x-sedra-capability: inventory.stock_locations.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: inventory_stock_locations_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: inventory:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/jobs.status:
    post:
      description: Shows the heartbeat of Sedra background jobs (last run, status, run count). Platform-wide, read-only.
      operationId: jobs_status
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
              required: []
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Monitor background jobs
      tags:
        - jobs
      x-sedra-action: read
      x-sedra-capability: jobs.status
      x-sedra-human-only: false
      x-sedra-mcp-tool: jobs_status
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: operations:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: false
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/marketplace.payouts.summary:
    post:
      description: >-
        Totals per vendor for a period: sales, marketplace commission and amount owed to the vendor (fulfilled orders
        only count as payable). Vendors see only their own line.
      operationId: marketplace_payouts_summary
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    from:
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                    to:
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Vendor payout summary
      tags:
        - marketplace
      x-sedra-action: read
      x-sedra-capability: marketplace.payouts.summary
      x-sedra-human-only: false
      x-sedra-mcp-tool: marketplace_payouts_summary
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: reports:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/marketplace.vendor_orders.list:
    post:
      description: >-
        Per-vendor shares of marketplace orders (items, subtotal, commission, payout, status). Vendors see only their
        own; operators can filter by vendor.
      operationId: marketplace_vendor_orders_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 25
                      maximum: 100
                      minimum: 1
                      type: integer
                    status:
                      enum:
                        - open
                        - fulfilled
                        - canceled
                      type: string
                    vendor_id:
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List vendor order shares
      tags:
        - marketplace
      x-sedra-action: read
      x-sedra-capability: marketplace.vendor_orders.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: marketplace_vendor_orders_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: orders:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/marketplace.vendors.list:
    post:
      description: >-
        Lists the vendors selling in this marketplace with status, commission rate, product count and sales in the last
        30 days.
      operationId: marketplace_vendors_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    status:
                      enum:
                        - active
                        - suspended
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List marketplace vendors
      tags:
        - marketplace
      x-sedra-action: read
      x-sedra-capability: marketplace.vendors.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: marketplace_vendors_list
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/marketplace.vendors.set_commission:
    post:
      description: >-
        Changes the commission percentage the marketplace keeps from a vendor's sales. Applies to new orders. Sensitive:
        requires human approval.
      operationId: marketplace_vendors_set_commission
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    commission_rate:
                      maximum: 50
                      minimum: 0
                      type: number
                    vendor_id:
                      type: string
                  required:
                    - vendor_id
                    - commission_rate
                  type: object
                reason:
                  type: string
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Change a vendor's commission (approval required)
      tags:
        - marketplace
      x-sedra-action: sensitive
      x-sedra-capability: marketplace.vendors.set_commission
      x-sedra-human-only: false
      x-sedra-mcp-tool: marketplace_vendors_set_commission
      x-sedra-min-role: manager
      x-sedra-requires-approval: true
      x-sedra-scope: payments:sensitive
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/marketplace.vendors.set_status:
    post:
      description: >-
        Suspends a vendor (its products stay listed only if you also unpublish them) or reactivates it. Suspended
        vendors cannot make changes.
      operationId: marketplace_vendors_set_status
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    reason:
                      maxLength: 300
                      type: string
                    status:
                      enum:
                        - active
                        - suspended
                      type: string
                    vendor_id:
                      type: string
                  required:
                    - vendor_id
                    - status
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Suspend or reactivate a vendor
      tags:
        - marketplace
      x-sedra-action: write
      x-sedra-capability: marketplace.vendors.set_status
      x-sedra-human-only: false
      x-sedra-mcp-tool: marketplace_vendors_set_status
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: catalog:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/operations.audit_log:
    post:
      description: Returns recent audited operations for a business, newest first.
      operationId: operations_audit_log
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    actor_id:
                      type: string
                    limit:
                      default: 50
                      maximum: 200
                      minimum: 1
                      type: integer
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Read the AI/integration audit log
      tags:
        - operations
      x-sedra-action: read
      x-sedra-capability: operations.audit_log
      x-sedra-human-only: false
      x-sedra-mcp-tool: operations_audit_log
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: operations:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/operations.failed:
    post:
      description: >-
        Returns recent failed or denied capability calls for a business (from the audit log) to help diagnose
        integration or permission problems.
      operationId: operations_failed
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 25
                      maximum: 100
                      minimum: 1
                      type: integer
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Review failed or denied operations
      tags:
        - operations
      x-sedra-action: read
      x-sedra-capability: operations.failed
      x-sedra-human-only: false
      x-sedra-mcp-tool: operations_failed
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: operations:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/orders.fulfillment.create:
    post:
      description: >-
        Creates a fulfillment for all (or the listed) unfulfilled items of an order in the selected business, from one
        of its stock locations. Supports dry_run.
      operationId: orders_fulfillment_create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    items:
                      items:
                        properties:
                          id:
                            type: string
                          quantity:
                            maximum: 9007199254740991
                            minimum: 1
                            type: integer
                        required:
                          - id
                          - quantity
                        type: object
                      type: array
                    location_id:
                      type: string
                    order_id:
                      type: string
                  required:
                    - order_id
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Fulfill order items
      tags:
        - orders
      x-sedra-action: write
      x-sedra-capability: orders.fulfillment.create
      x-sedra-human-only: false
      x-sedra-mcp-tool: orders_fulfillment_create
      x-sedra-min-role: operator
      x-sedra-requires-approval: false
      x-sedra-scope: orders:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/orders.get:
    post:
      description: Returns one order of the selected business including items, totals, payments and fulfillments.
      operationId: orders_get
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    id:
                      type: string
                  required:
                    - id
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Get an order
      tags:
        - orders
      x-sedra-action: read
      x-sedra-capability: orders.get
      x-sedra-human-only: false
      x-sedra-mcp-tool: orders_get
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: orders:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/orders.list:
    post:
      description: >-
        Lists the selected business's orders, newest first, with payment and fulfillment status. Customer emails are
        masked.
      operationId: orders_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    limit:
                      default: 20
                      maximum: 100
                      minimum: 1
                      type: integer
                    offset:
                      default: 0
                      maximum: 9007199254740991
                      minimum: 0
                      type: integer
                    since:
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                    status:
                      enum:
                        - pending
                        - completed
                        - draft
                        - archived
                        - canceled
                        - requires_action
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Review orders
      tags:
        - orders
      x-sedra-action: read
      x-sedra-capability: orders.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: orders_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: orders:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/orders.refund:
    post:
      description: >-
        Refunds all or part of an order's captured payment. Sensitive: creates an approval request; nothing is refunded
        until a human manager approves.
      operationId: orders_refund
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    amount:
                      exclusiveMinimum: 0
                      type: number
                    note:
                      maxLength: 500
                      type: string
                    order_id:
                      type: string
                  required:
                    - order_id
                  type: object
                reason:
                  type: string
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Refund an order payment (approval required)
      tags:
        - orders
      x-sedra-action: sensitive
      x-sedra-capability: orders.refund
      x-sedra-human-only: false
      x-sedra-mcp-tool: orders_refund
      x-sedra-min-role: manager
      x-sedra-requires-approval: true
      x-sedra-scope: payments:sensitive
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/platform.capabilities:
    post:
      description: >-
        Lists every Sedra capability with its input schema, required scope and whether it needs approval. Only
        capabilities you hold the scope for are marked usable.
      operationId: platform_capabilities
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
              required: []
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List platform capabilities
      tags:
        - platform
      x-sedra-action: read
      x-sedra-capability: platform.capabilities
      x-sedra-human-only: false
      x-sedra-mcp-tool: platform_capabilities
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: platform:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: false
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/platform.whoami:
    post:
      description: Returns the authenticated identity, its granted scopes and the businesses it can access with which role.
      operationId: platform_whoami
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
              required: []
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Describe the current identity
      tags:
        - platform
      x-sedra-action: read
      x-sedra-capability: platform.whoami
      x-sedra-human-only: false
      x-sedra-mcp-tool: platform_whoami
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: platform:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: false
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/promotions.create:
    post:
      description: >-
        Creates an order-level discount code for the selected business (percentage or fixed amount in the business
        currency). Created as draft unless activate=true. Supports dry_run.
      operationId: promotions_create
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    activate:
                      default: false
                      type: boolean
                    code:
                      description: Upper-case code, 3-32 chars
                      pattern: ^[A-Z0-9_-]{3,32}$
                      type: string
                    type:
                      enum:
                        - percentage
                        - fixed
                      type: string
                    value:
                      exclusiveMinimum: 0
                      maximum: 100000
                      type: number
                  required:
                    - code
                    - type
                    - value
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Create a promotion code
      tags:
        - promotions
      x-sedra-action: write
      x-sedra-capability: promotions.create
      x-sedra-human-only: false
      x-sedra-mcp-tool: promotions_create
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: promotions:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/promotions.list:
    post:
      description: Lists the selected business's promotions (codes, type, value, status).
      operationId: promotions_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List promotions
      tags:
        - promotions
      x-sedra-action: read
      x-sedra-capability: promotions.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: promotions_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: promotions:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/promotions.set_status:
    post:
      description: Changes a promotion's status (active / inactive / draft) in the selected business.
      operationId: promotions_set_status
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    id:
                      type: string
                    status:
                      enum:
                        - active
                        - inactive
                        - draft
                      type: string
                  required:
                    - id
                    - status
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Activate or deactivate a promotion
      tags:
        - promotions
      x-sedra-action: write
      x-sedra-capability: promotions.set_status
      x-sedra-human-only: false
      x-sedra-mcp-tool: promotions_set_status
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: promotions:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/reports.compare_businesses:
    post:
      description: >-
        Compares sales across every business this identity can report on (it silently skips businesses it is not
        authorized for). Default period: last 30 days.
      operationId: reports_compare_businesses
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    from:
                      description: Defaults to 30 days ago
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                    to:
                      description: Defaults to now
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                  type: object
              required: []
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Compare business performance
      tags:
        - reports
      x-sedra-action: read
      x-sedra-capability: reports.compare_businesses
      x-sedra-human-only: false
      x-sedra-mcp-tool: reports_compare_businesses
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: reports:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: false
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/reports.daily_briefing:
    post:
      description: >-
        One-call morning summary: today and yesterday vs the same days last week, orders waiting to be fulfilled,
        low-stock items and pending approvals. Times use Asia/Bahrain.
      operationId: reports_daily_briefing
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    low_stock_threshold:
                      default: 5
                      maximum: 9007199254740991
                      minimum: 0
                      type: integer
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Daily business briefing
      tags:
        - reports
      x-sedra-action: read
      x-sedra-capability: reports.daily_briefing
      x-sedra-human-only: false
      x-sedra-mcp-tool: reports_daily_briefing
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: reports:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/reports.inventory:
    post:
      description: >-
        Stock totals per variant for the selected business plus a list of low-stock items at or below the threshold
        (default 5).
      operationId: reports_inventory
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    low_stock_threshold:
                      default: 5
                      maximum: 9007199254740991
                      minimum: 0
                      type: integer
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Inventory report
      tags:
        - reports
      x-sedra-action: read
      x-sedra-capability: reports.inventory
      x-sedra-human-only: false
      x-sedra-mcp-tool: reports_inventory
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: reports:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/reports.sales_summary:
    post:
      description: >-
        Revenue, order count, average order value, daily breakdown and top products for the selected business over a
        period (default last 30 days). Amounts are in the business currency (BHD has 3 decimals).
      operationId: reports_sales_summary
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties:
                    from:
                      description: Defaults to 30 days ago
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                    to:
                      description: Defaults to now
                      format: date-time
                      pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                      type: string
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Sales summary
      tags:
        - reports
      x-sedra-action: read
      x-sedra-capability: reports.sales_summary
      x-sedra-human-only: false
      x-sedra-mcp-tool: reports_sales_summary
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: reports:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/storefront.content.get:
    post:
      description: >-
        Returns the selected business's editable storefront content (announcement bar, hero texts, SEO description) and
        theme tokens.
      operationId: storefront_content_get
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Get storefront content
      tags:
        - storefront
      x-sedra-action: read
      x-sedra-capability: storefront.content.get
      x-sedra-human-only: false
      x-sedra-mcp-tool: storefront_content_get
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: storefront:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/storefront.content.update:
    post:
      description: >-
        Updates bilingual storefront content (announcement, hero title/subtitle, SEO description) for the selected
        business. Theme colors are changed with theme_tokens (hex colors only). Supports dry_run.
      operationId: storefront_content_update
      requestBody:
        content:
          application/json:
            schema:
              properties:
                dry_run:
                  type: boolean
                idempotency_key:
                  maxLength: 128
                  minLength: 8
                  type: string
                input:
                  additionalProperties: false
                  properties:
                    announcement:
                      additionalProperties: false
                      properties:
                        ar:
                          maxLength: 500
                          type: string
                        en:
                          maxLength: 500
                          type: string
                      type: object
                    hero_subtitle:
                      additionalProperties: false
                      properties:
                        ar:
                          maxLength: 500
                          type: string
                        en:
                          maxLength: 500
                          type: string
                      type: object
                    hero_title:
                      additionalProperties: false
                      properties:
                        ar:
                          maxLength: 500
                          type: string
                        en:
                          maxLength: 500
                          type: string
                      type: object
                    seo_description:
                      additionalProperties: false
                      properties:
                        ar:
                          maxLength: 500
                          type: string
                        en:
                          maxLength: 500
                          type: string
                      type: object
                    theme_tokens:
                      additionalProperties:
                        pattern: ^#[0-9a-fA-F]{6}$
                        type: string
                      propertyNames:
                        enum:
                          - primary
                          - accent
                          - background
                          - surface
                          - text
                          - muted
                        type: string
                      required:
                        - primary
                        - accent
                        - background
                        - surface
                        - text
                        - muted
                      type: object
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
                - idempotency_key
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Pending human approval
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '409':
          $ref: '#/components/responses/SedraConflict'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Update storefront content
      tags:
        - storefront
      x-sedra-action: write
      x-sedra-capability: storefront.content.update
      x-sedra-human-only: false
      x-sedra-mcp-tool: storefront_content_update
      x-sedra-min-role: manager
      x-sedra-requires-approval: false
      x-sedra-scope: storefront:write
      x-sedra-supports-dry-run: true
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
  /foulad/agent/invoke/tenant.config.get:
    post:
      description: >-
        Returns one business's configuration: currency, locales, timezone, domains, theme tokens, storefront content and
        the Medusa resources it owns (sales channels, stock locations). Contains no secrets.
      operationId: tenant_config_get
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
                tenant:
                  description: Business id (ten_...) or handle
                  type: string
              required:
                - tenant
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: Inspect business configuration
      tags:
        - tenant
      x-sedra-action: read
      x-sedra-capability: tenant.config.get
      x-sedra-human-only: false
      x-sedra-mcp-tool: tenant_config_get
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: platform:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: true
      x-sedra-untrusted-content: true
      x-sedra-vendor-aware: true
  /foulad/agent/invoke/tenants.list:
    post:
      description: >-
        Lists the businesses (tenants) this identity may operate, with currency, locales and its role. Use a business
        handle or id as the `tenant` argument of other tools.
      operationId: tenants_list
      requestBody:
        content:
          application/json:
            schema:
              properties:
                input:
                  additionalProperties: false
                  properties: {}
                  type: object
              required: []
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvokeResult'
          description: Success or dry-run
        '400':
          $ref: '#/components/responses/SedraBadRequest'
        '401':
          $ref: '#/components/responses/SedraUnauthorized'
        '403':
          $ref: '#/components/responses/SedraForbidden'
        '404':
          $ref: '#/components/responses/SedraNotFound'
        '429':
          $ref: '#/components/responses/SedraRateLimited'
      security:
        - sedra_api_key: []
      summary: List authorized businesses
      tags:
        - tenants
      x-sedra-action: read
      x-sedra-capability: tenants.list
      x-sedra-human-only: false
      x-sedra-mcp-tool: tenants_list
      x-sedra-min-role: viewer
      x-sedra-requires-approval: false
      x-sedra-scope: platform:read
      x-sedra-supports-dry-run: false
      x-sedra-tenant-scoped: false
      x-sedra-untrusted-content: false
      x-sedra-vendor-aware: false
security:
  - sedra_api_key: []
servers:
  - description: Development environment (demo data, sandbox payments)
    url: https://api.sedra.one
tags:
  - description: Sensitive operations awaiting human approval.
    name: approvals
  - description: Products, prices and categories.
    name: catalog
  - description: Customers (masked contact details).
    name: customers
  - description: Vending machines and kiosks (read and business configuration only).
    name: devices
  - description: Stock levels and locations.
    name: inventory
  - description: Background job health.
    name: jobs
  - description: Marketplace vendors, vendor orders and payouts.
    name: marketplace
  - description: Audit log and failed operations.
    name: operations
  - description: Orders, fulfilment and refunds.
    name: orders
  - description: Discover your identity and the operations you may use.
    name: platform
  - description: Discount codes.
    name: promotions
  - description: Sales, inventory and daily briefings.
    name: reports
  - description: Storefront content and theme tokens.
    name: storefront
  - description: Business configuration.
    name: tenant
  - description: Businesses this credential may operate.
    name: tenants
