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

# Create export

> Prepare a risk package, evidence set or billing report for download. Each kind requires its own source permissions in addition to export access.

Prepare a risk package, evidence set or billing report for download. Each kind requires its own source permissions in addition to export access. All IDs and cursors must belong to the authorized workspace and environment. Required scope: exports:write. Data exports require data:read and source authorization; risk-package exports require results:read; billing exports require billing:read and Owner authority; evidence exports require evidence:read and source entitlements. Permissions are checked at creation, retrieval and download.

Examples use synthetic IDs. Replace them with values returned by your environment.


## OpenAPI

````yaml openapi/amlok.json POST /v1/exports
openapi: 3.1.0
info:
  title: AMLOK API
  version: 1.0.0
  description: >-
    AMLOK API: borrower connections, Insights origination, immutable risk
    packages and Signal monitoring. Use your institution-issued API origin.
servers: []
security:
  - BearerAuth: []
paths:
  /v1/exports:
    post:
      tags:
        - Exports
      summary: Create export
      description: >-
        Prepare a risk package, evidence set or billing report for download.
        Each kind requires its own source permissions in addition to export
        access. All IDs and cursors must belong to the authorized workspace and
        environment. Required scope: exports:write. Data exports require
        data:read and source authorization; risk-package exports require
        results:read; billing exports require billing:read and Owner authority;
        evidence exports require evidence:read and source entitlements.
        Permissions are checked at creation, retrieval and download.
      operationId: createExport
      parameters:
        - name: Idempotency-Key
          in: header
          required: true
          schema:
            type: string
            minLength: 1
          description: >-
            Stable for one intended command and its retries, scoped to key
            workspace/environment and operation. Mismatched body returns 409.
            Full response replay 24 hours; durable receipt remains.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExport'
            example:
              kind: risk_package
              risk_package_id: rp_synthetic
              format: json
      responses:
        '202':
          description: Accepted asynchronously; inspect status, not just HTTP success.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Export'
                  meta:
                    $ref: '#/components/schemas/Meta'
                required:
                  - data
                  - meta
                additionalProperties: false
              example:
                data:
                  id: exp_synthetic
                  status: queued
                  created_at: '2026-11-06T12:00:00Z'
                  format: json
                  source:
                    kind: risk_package
                    risk_package_id: rp_synthetic
                    format: json
                  failure: null
                  record_version: 1
                  expires_at: null
                meta:
                  request_id: req_synthetic
                  schema_version: 1.0.0
                  environment: sandbox
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '400':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: validation_error
                  message: Validation error.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '401':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: unauthenticated
                  message: Unauthenticated.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '402':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: insufficient_credits
                  message: Insufficient credits.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '403':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: forbidden
                  message: Forbidden.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '404':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: not_found
                  message: Not found.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '409':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: idempotency_conflict
                  message: Idempotency conflict.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '410':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: cursor_expired
                  message: Cursor expired.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '413':
          description: >-
            Request exceeds the effective profile size limit or media type is
            unsupported. No command is accepted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: payload_too_large
                  message: payload too large
                  retryable: false
                  request_id: req_synthetic
                  field: null
        '415':
          description: >-
            Request exceeds the effective profile size limit or media type is
            unsupported. No command is accepted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: unsupported_media_type
                  message: unsupported media type
                  retryable: false
                  request_id: req_synthetic
                  field: null
        '422':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: validation_error
                  message: Validation error.
                  retryable: false
                  request_id: req_synthetic
                  field: null
          headers:
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '429':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: rate_limited
                  message: Rate limited.
                  retryable: true
                  request_id: req_synthetic
                  field: null
          headers:
            Retry-After:
              description: Minimum delay in seconds before retry.
              schema:
                type: integer
                minimum: 0
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
        '503':
          description: >-
            Inspect structured error; retry only when retryable. 429 and 503 can
            include Retry-After.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    $ref: '#/components/schemas/Error'
                required:
                  - error
                additionalProperties: false
              example:
                error:
                  code: temporarily_unavailable
                  message: Temporarily unavailable.
                  retryable: true
                  request_id: req_synthetic
                  field: null
          headers:
            Retry-After:
              description: Minimum delay in seconds before retry.
              schema:
                type: integer
                minimum: 0
            X-Request-ID:
              schema:
                type: string
                minLength: 1
              description: Same request ID as meta.request_id or error.request_id.
      security:
        - BearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: cURL
          source: |-
            curl --request POST --fail-with-body --max-time 30 \
              "${AMLOK_API_BASE_URL}/v1/exports" \
              --header "Authorization: Bearer ${AMLOK_API_KEY}" \
              --header 'Accept: application/json' \
              --header 'Idempotency-Key: createExport-synthetic-0042' \
              --header 'Content-Type: application/json' \
              --data '{"kind":"risk_package","risk_package_id":"rp_synthetic","format":"json"}'
        - lang: Python
          source: >
            import os

            import requests


            headers = {'Accept': 'application/json', 'Idempotency-Key':
            'createExport-synthetic-0042', 'Content-Type': 'application/json'}

            headers["Authorization"] = "Bearer " + os.environ["AMLOK_API_KEY"]

            response = requests.request('POST', os.environ["AMLOK_API_BASE_URL"]
            + '/v1/exports', headers=headers, json={'kind': 'risk_package',
            'risk_package_id': 'rp_synthetic', 'format': 'json'}, timeout=30,
            allow_redirects=False)

            response.raise_for_status()

            print(response.json())
        - lang: JavaScript
          source: >
            const headers = {"Accept": "application/json", "Idempotency-Key":
            "createExport-synthetic-0042", "Content-Type": "application/json"};

            headers.Authorization = `Bearer ${process.env.AMLOK_API_KEY}`;

            const response = await fetch(process.env.AMLOK_API_BASE_URL +
            "/v1/exports", {
              method: "POST", headers, redirect: "error", signal: AbortSignal.timeout(30000),
              body: JSON.stringify({"kind": "risk_package", "risk_package_id": "rp_synthetic", "format": "json"})
            });

            if (!response.ok) throw new Error(`HTTP ${response.status}: ${await
            response.text()}`);

            console.log(await response.json());
components:
  schemas:
    CreateExport:
      type: object
      properties:
        kind:
          type: string
          enum:
            - risk_package
            - evidence
            - billing
            - data
          description: >-
            Kind for CreateExport. Constraints, requiredness and allowed values
            are defined by this schema.
        risk_package_id:
          type: string
          minLength: 1
          description: >-
            Opaque identifier, authorized within the API key workspace and
            environment.
        evidence_set_id:
          type: string
          minLength: 1
          description: >-
            Opaque identifier, authorized within the API key workspace and
            environment.
        billing_report_type:
          type: string
          enum:
            - usage
            - credits
            - statements
            - funding
            - rates
            - workload
          description: >-
            Billing report type for CreateExport. Constraints, requiredness and
            allowed values are defined by this schema.
        window:
          $ref: '#/components/schemas/Window'
          description: >-
            Window for CreateExport. Constraints, requiredness and allowed
            values are defined by this schema.
        format:
          type: string
          enum:
            - json
            - csv
            - pdf
          description: >-
            Format for CreateExport. Constraints, requiredness and allowed
            values are defined by this schema.
        data_snapshot_id:
          type: string
          minLength: 1
          description: Opaque ID within the authorized workspace and environment.
      required:
        - kind
        - format
      additionalProperties: false
      oneOf:
        - properties:
            kind:
              const: risk_package
            format:
              type: string
              enum:
                - json
                - pdf
          required:
            - risk_package_id
          not:
            anyOf:
              - required:
                  - evidence_set_id
              - required:
                  - billing_report_type
              - required:
                  - window
              - required:
                  - data_snapshot_id
          title: Risk-package export
        - properties:
            kind:
              const: evidence
            format:
              type: string
              enum:
                - json
                - csv
          required:
            - evidence_set_id
          not:
            anyOf:
              - required:
                  - risk_package_id
              - required:
                  - billing_report_type
              - required:
                  - window
              - required:
                  - data_snapshot_id
          title: Evidence export
        - properties:
            kind:
              const: billing
            format:
              type: string
              enum:
                - json
                - csv
          required:
            - billing_report_type
            - window
          not:
            anyOf:
              - required:
                  - risk_package_id
              - required:
                  - evidence_set_id
              - required:
                  - data_snapshot_id
          title: Billing export
        - title: Collected data export
          properties:
            kind:
              const: data
            format:
              type: string
              enum:
                - json
                - csv
          required:
            - data_snapshot_id
          not:
            anyOf:
              - required:
                  - risk_package_id
              - required:
                  - evidence_set_id
              - required:
                  - billing_report_type
              - required:
                  - window
    Export:
      type: object
      properties:
        id:
          type: string
          minLength: 1
          description: >-
            Opaque identifier, authorized within the API key workspace and
            environment.
        status:
          type: string
          enum:
            - queued
            - processing
            - completed
            - failed
          description: >-
            Current lifecycle state. See the product lifecycle and recovery
            guides.
        created_at:
          type: string
          minLength: 1
          format: date-time
          description: UTC time the record was created.
        format:
          type: string
          enum:
            - json
            - csv
            - pdf
          description: >-
            Format for Export. Constraints, requiredness and allowed values are
            defined by this schema.
        source:
          $ref: '#/components/schemas/CreateExport'
          description: >-
            Source for Export. Constraints, requiredness and allowed values are
            defined by this schema.
        failure:
          anyOf:
            - $ref: '#/components/schemas/Error'
            - type: 'null'
          description: >-
            Failure for Export. Constraints, requiredness and allowed values are
            defined by this schema.
        expires_at:
          anyOf:
            - type: string
              minLength: 1
              description: >-
                Retained file expiry; null until completed. Separate from each
                download-link expiry.
              format: date-time
            - type: 'null'
          description: UTC expiration; do not use this resource after this instant.
        record_version:
          type: integer
          minimum: 1
          description: >-
            Monotonic version for this resource; compare with
            event.resource_version.
      required:
        - id
        - status
        - created_at
        - format
        - source
        - failure
        - expires_at
        - record_version
      additionalProperties: false
      allOf:
        - if:
            properties:
              status:
                const: completed
          then:
            properties:
              expires_at:
                type: string
                minLength: 1
                description: UTC timestamp in RFC 3339 format.
                format: date-time
              failure:
                type: 'null'
        - if:
            properties:
              status:
                const: failed
          then:
            properties:
              failure:
                $ref: '#/components/schemas/Error'
    Meta:
      type: object
      properties:
        request_id:
          type: string
          minLength: 1
          description: >-
            Opaque identifier, authorized within the API key workspace and
            environment.
        schema_version:
          type: string
          minLength: 1
          description: >-
            Schema version for Meta. Constraints, requiredness and allowed
            values are defined by this schema.
        environment:
          type: string
          enum:
            - sandbox
            - live
          description: >-
            Environment for Meta. Constraints, requiredness and allowed values
            are defined by this schema.
      required:
        - request_id
        - schema_version
        - environment
      additionalProperties: false
    Error:
      type: object
      properties:
        code:
          type: string
          enum:
            - validation_error
            - unauthenticated
            - forbidden
            - not_found
            - invalid_state
            - idempotency_conflict
            - insufficient_credits
            - precondition_failed
            - cursor_expired
            - rate_limited
            - temporarily_unavailable
            - deal_snapshot_conflict
            - payload_too_large
            - unsupported_media_type
            - document_rejected
            - processing_failed
            - session_expired
            - consent_purpose_missing
            - sandbox_only
            - scenario_not_available
            - idempotency_result_expired
          description: >-
            Code for Error. Constraints, requiredness and allowed values are
            defined by this schema.
        message:
          type: string
          minLength: 1
          description: >-
            Message for Error. Constraints, requiredness and allowed values are
            defined by this schema.
        retryable:
          type: boolean
          description: >-
            Retryable for Error. Constraints, requiredness and allowed values
            are defined by this schema.
        request_id:
          type: string
          minLength: 1
          description: >-
            Opaque identifier, authorized within the API key workspace and
            environment.
        field:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
          description: >-
            Field for Error. Constraints, requiredness and allowed values are
            defined by this schema.
      required:
        - code
        - message
        - retryable
        - request_id
        - field
      additionalProperties: false
    Window:
      type: object
      properties:
        start:
          type: string
          minLength: 1
          format: date-time
          description: >-
            Start for Window. Constraints, requiredness and allowed values are
            defined by this schema.
        end:
          type: string
          minLength: 1
          format: date-time
          description: >-
            End for Window. Constraints, requiredness and allowed values are
            defined by this schema.
      required:
        - start
        - end
      additionalProperties: false
      description: UTC interval [start, end). The server rejects end <= start.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: >-
        Server-to-server API key bound to exactly one workspace, institution
        tenant and environment. No caller-supplied workspace override is
        accepted. Do not use in public browser code.

````

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