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

# Run python code

> Durable background run in a fresh Vercel Sandbox. Reserves the worst case up front (5p + 1p per second of the timeout, default 60s, max 300s), settles the actual wall-clock cost when the run completes, and releases the remainder. Poll GET /executions/{id} for output. Execution is at-least-once: an infrastructure retry may run side-effecting code twice.



## OpenAPI

````yaml api/openapi.json POST /executions
openapi: 3.1.0
info:
  title: Amoreg Regulatory Knowledge API
  version: 1.0.0
  description: >-
    Hybrid semantic + keyword search over Amoreg's regulatory knowledge base,
    scoped to the jurisdictions enabled for your organisation. Prepaid credits
    in GBP: 2p per search, 2p per screening keyword.
servers:
  - url: https://app.amoreg.com/api/v1
security:
  - apiKey: []
paths:
  /executions:
    post:
      summary: Run python code in an isolated sandbox
      description: >-
        Durable background run in a fresh Vercel Sandbox. Reserves the worst
        case up front (5p + 1p per second of the timeout, default 60s, max
        300s), settles the actual wall-clock cost when the run completes, and
        releases the remainder. Poll GET /executions/{id} for output. Execution
        is at-least-once: an infrastructure retry may run side-effecting code
        twice.
      operationId: createExecution
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
                  maxLength: 65536
                  description: Python source to execute.
                timeoutSeconds:
                  type: integer
                  minimum: 1
                  maximum: 300
                  default: 60
              required:
                - code
      responses:
        '202':
          description: Accepted — execution started
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                  status:
                    type: string
                  estimatedCostPence:
                    type: integer
        '402':
          description: Insufficient credit
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        details:
          type: string
      required:
        - error
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        Organisation API key created in the dashboard (format: amrg_live_…).
        Sent as `Authorization: Bearer amrg_live_…`.

````