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

# Export Policy

> A portable copy of the policy for backup or sharing. Import it with the import endpoint.



## OpenAPI

````yaml GET /router/policies/{policy_id}/export
openapi: 3.0.1
info:
  title: Electron Hub API
  description: >-
    Unified API platform integrating 200+ AI models for chat, image generation,
    speech-to-text, embeddings, and more.
  version: 1.0.0
  contact:
    name: Electron Hub Support
    email: support@electronhub.ai
    url: https://discord.com/invite/electronhub
  license:
    name: MIT
servers:
  - url: https://api.electronhub.ai/v1
    description: Production API v1
security:
  - bearerAuth: []
paths:
  /router/policies/{policy_id}/export:
    get:
      tags:
        - Router
      summary: Export policy
      description: >-
        A portable copy of the policy for backup or sharing. Import it with the
        import endpoint.
      operationId: exportRouterPolicy
      parameters:
        - name: policy_id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[a-z0-9-]{1,40}$
          example: work
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RouterPolicy'
              example:
                policyId: work
                name: Work
                schemaVersion: 4
                mode: auto
                auto:
                  costTier: high
                  qualityFloor: 0
                  preferFast: false
                  preferVendor: null
                  preferStrength: 0
                  maxTtft: 0
                  perCategory: {}
                custom:
                  rules: []
                  default:
                    - action: useAuto
                models:
                  allowed: []
                  excluded:
                    - '*:free'
                  strictAllowed: false
                guardrails:
                  maxCostPerReq: null
                  blockOverCost: false
                  budgetUsd: 5
                  budgetWindow: daily
                  budgetScope: routed
                  blockOverBudget: false
                  pii:
                    enabled: false
                    action: block
                    model: null
                    entities: {}
                    labels: {}
                    custom: []
                    scanAll: false
                cache:
                  enabled: false
                  ttlMin: 1440
                  maxEntries: 100
                  semantic: false
                  semanticThreshold: 0.9
                kind: electron-hub.router-policy
                exportedAt: '2026-11-08T07:34:14.933183Z'
        '403':
          description: Proxy keys cannot manage Router settings
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: Only master keys can manage Router settings.
                  type: error
                  param: null
                  code: 403
        '404':
          description: Policy not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  message: Router policy “missing” was not found.
                  type: router_policy_not_found
                  param: null
                  code: 404
components:
  schemas:
    RouterPolicy:
      type: object
      description: >-
        Missing fields take defaults. See
        https://docs.electronhub.ai/routing/auto-router#policies
      properties:
        policyId:
          type: string
          pattern: ^[a-z0-9-]{1,40}$
        name:
          type: string
        schemaVersion:
          type: integer
          example: 4
        mode:
          type: string
          enum:
            - auto
            - custom
          description: '`custom` evaluates `custom.rules` first.'
        auto:
          type: object
          properties:
            costTier:
              type: string
              enum:
                - low
                - medium
                - high
                - xhigh
                - max
              default: medium
            qualityFloor:
              type: number
              minimum: 0
              maximum: 100
              description: Minimum benchmark score (0 = off).
            preferFast:
              type: boolean
              description: Prefer models with the fastest end-to-end response.
            preferVendor:
              type: string
              nullable: true
              description: Vendor to favour, e.g. `Anthropic`.
            preferStrength:
              type: number
              minimum: 0
              maximum: 0.2
              description: How strongly to favour `preferVendor`.
            maxTtft:
              type: number
              minimum: 0
              description: Maximum seconds to the first answer token (0 = off).
            perCategory:
              type: object
              additionalProperties:
                type: string
              description: >-
                Fixed model per category, e.g. `{"coding":
                "claude-sonnet-5-5"}`.
        custom:
          type: object
          properties:
            rules:
              type: array
              items:
                type: object
              description: >-
                Ordered rules: `when` conditions on request signals, `then`
                actions.
            default:
              type: array
              items:
                type: object
              description: 'Actions when no rule matches. Default `[{"action": "useAuto"}]`.'
        models:
          type: object
          properties:
            allowed:
              type: array
              items:
                type: string
              description: Model patterns, e.g. `anthropic/*`.
            excluded:
              type: array
              items:
                type: string
            strictAllowed:
              type: boolean
              description: Fail with 404 when `allowed` matches nothing.
        guardrails:
          type: object
          properties:
            maxCostPerReq:
              type: number
              nullable: true
              description: Estimated cost cap per request, in USD.
            blockOverCost:
              type: boolean
              description: Block instead of downgrading when over `maxCostPerReq`.
            budgetUsd:
              type: number
              nullable: true
              description: Spend budget per window, in USD.
            budgetWindow:
              type: string
              enum:
                - daily
                - weekly
                - monthly
              description: Windows start at 00:00 UTC.
            budgetScope:
              type: string
              enum:
                - routed
                - all
              description: Count Auto requests only, or all spend.
            blockOverBudget:
              type: boolean
              description: >-
                Block instead of using the cheapest model when the budget is
                spent.
            pii:
              type: object
              description: Privacy guard.
              properties:
                enabled:
                  type: boolean
                action:
                  type: string
                  enum:
                    - block
                    - redact
                    - route
                model:
                  type: string
                  nullable: true
                  description: 'Model for `action: route`.'
                entities:
                  type: object
                  additionalProperties:
                    type: boolean
                  description: Entity types to detect; empty means all except `name`.
                scanAll:
                  type: boolean
                  description: Scan every message, not only the latest.
        cache:
          type: object
          description: Response cache for repeated requests.
          properties:
            enabled:
              type: boolean
            ttlMin:
              type: integer
              minimum: 1
              maximum: 43200
            maxEntries:
              type: integer
              minimum: 1
              maximum: 5000
            semantic:
              type: boolean
              description: Also match similar, not only identical, requests.
            semanticThreshold:
              type: number
              minimum: 0.8
              maximum: 0.99
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
            type:
              type: string
            code:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your API key (starts with 'ek-')

````

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