# Score a transcript or a recording

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/voice/scan:
    post:
      summary: Score a transcript or a recording
      deprecated: false
      description: >-
        Classify one call after the fact. Send a transcript, or audio as base64
        or as a multipart file named `audio`. Exactly one of transcript or audio
        is required. Costs 2 credits per request plus 1 credit per started
        minute of uploaded audio. A request rejected with 400 costs nothing. The
        body limit is 25 MB. The request times out after 90 seconds.


        With `report=true` and `from` present, a score of 0.8 or more files the
        caller and every callback number as a complaint. `none`, `Advertising`,
        `Surveys`, `Hang Up`, and `No Subject Provided` are never filed. `Other`
        needs 0.85.


        Multipart is also accepted: a file field named `audio` plus the same
        fields as form values.
      operationId: voiceScan
      tags:
        - Spam protection/Voice firewall/REST
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              description: Exactly one of `transcript` or `audio_base64` is required.
              properties:
                transcript:
                  type: string
                  description: Text of the call.
                audio_base64:
                  type: string
                  description: Base64 audio.
                encoding:
                  type: string
                  enum:
                    - wav
                    - pcm16
                    - mulaw
                  default: wav
                  description: >-
                    `wav` needs a RIFF header. `pcm16` is 16-bit little-endian
                    and needs `sample_rate`. `mulaw` defaults to 8000 Hz.
                sample_rate:
                  type: integer
                  minimum: 8000
                  maximum: 48000
                  description: Required for `pcm16`.
                language:
                  type: string
                  description: BCP-47 hint for transcription.
                from:
                  type: string
                  description: >-
                    Caller number in E.164 with a leading `+`. Required for
                    `report`.
                to:
                  type: string
                  description: Called number in E.164.
                report:
                  type: boolean
                  default: false
                  description: File the caller when the score is 0.8 or more.
      responses:
        '200':
          description: The verdict, the intel, and the transcript.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - session_id
                  - verdict
                  - intel
                  - transcript
                  - reported
                  - reported_numbers
                properties:
                  status:
                    type: string
                    enum:
                      - success
                  session_id:
                    type: string
                    format: uuid
                  verdict:
                    type: object
                    required:
                      - score
                      - level
                      - category
                      - tactics
                      - signals
                      - source
                    properties:
                      score:
                        type: number
                        minimum: 0
                        maximum: 1
                        description: Probability that the caller is a scammer.
                      level:
                        type: string
                        enum:
                          - clean
                          - suspicious
                          - likely_scam
                          - scam
                        description: >-
                          clean below 0.3. suspicious 0.3 to 0.59. likely_scam
                          0.6 to 0.84. scam 0.85 and above.
                      category:
                        type: string
                        description: >-
                          One exact CallerAPI complaint subject, or `none`. See
                          GET /api/voice/categories.
                      tactics:
                        type: array
                        items:
                          type: string
                          enum:
                            - urgency
                            - secrecy
                            - authority_impersonation
                            - remote_access
                            - untraceable_payment
                            - pii_harvest
                            - otp_request
                            - threat
                            - prize_lure
                            - family_fear
                            - refund_bait
                            - callback_pressure
                      signals:
                        type: array
                        items:
                          type: string
                        description: >-
                          Short pieces of evidence. Above a score of 0.6 they
                          quote the caller.
                      summary:
                        type: string
                        description: >-
                          Two sentences at most. Present when a model produced
                          the verdict.
                      source:
                        type: string
                        enum:
                          - heuristic
                          - llm
                          - combined
                          - stored
                  intel:
                    type: object
                    description: >-
                      Facts the caller exposed. Every field is omitted when
                      empty.
                    properties:
                      names:
                        type: array
                        items:
                          type: string
                      organizations:
                        type: array
                        items:
                          type: string
                      callback_numbers:
                        type: array
                        items:
                          type: string
                        description: E.164. Filed with the caller when `report` is on.
                      emails:
                        type: array
                        items:
                          type: string
                      urls:
                        type: array
                        items:
                          type: string
                      crypto_wallets:
                        type: array
                        items:
                          type: string
                      bank_accounts:
                        type: array
                        items:
                          type: string
                      card_numbers:
                        type: array
                        items:
                          type: string
                      gift_card_brands:
                        type: array
                        items:
                          type: string
                      payment_apps:
                        type: array
                        items:
                          type: string
                      remote_tools:
                        type: array
                        items:
                          type: string
                      remote_codes:
                        type: array
                        items:
                          type: string
                      case_numbers:
                        type: array
                        items:
                          type: string
                      amounts:
                        type: array
                        items:
                          type: string
                      addresses:
                        type: array
                        items:
                          type: string
                      scripts:
                        type: array
                        items:
                          type: string
                        description: Verbatim lines of the pitch.
                      dtmf:
                        type: string
                        description: Every digit pressed, in order.
                  transcript:
                    type: string
                  reported:
                    type: boolean
                  reported_numbers:
                    type: integer
                    description: 'Complaints filed: the caller plus every callback number.'
              example:
                status: success
                session_id: 3f0c1a2e-8b1d-4f7e-9c2a-1d2e3f4a5b6c
                verdict:
                  score: 0.93
                  level: scam
                  category: >-
                    Calls pretending to be government, businesses, or family and
                    friends
                  tactics:
                    - authority_impersonation
                    - threat
                    - untraceable_payment
                    - urgency
                  signals:
                    - invokes Social Security
                    - asks for gift cards
                    - threatens arrest or legal action
                  summary: >-
                    Caller impersonates Social Security and demands gift cards
                    under threat of arrest.
                  source: combined
                intel: {}
                transcript: >-
                  This is officer Smith from Social Security. Pay with gift
                  cards today or you will be arrested.
                reported: false
                reported_numbers: 0
          headers: {}
          x-apidog-name: The verdict, the intel, and the transcript
        '400':
          description: Bad input. The message says which field.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
              example:
                status: error
                message: 'forward is required: the E.164 number the call should ring'
          headers: {}
          x-apidog-name: Bad input
        '401':
          description: Missing or wrong API key.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
              example:
                status: error
                message: Unauthorized
          headers: {}
          x-apidog-name: Missing or wrong API key
        '402':
          description: Insufficient credits.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
              example:
                status: error
                message: Insufficient credits
          headers: {}
          x-apidog-name: Insufficient credits
        '502':
          description: Transcription failed.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
              example:
                status: error
                message: Transcription failed
          headers: {}
          x-apidog-name: Transcription failed
        '503':
          description: Audio was sent but speech recognition is off on this deployment.
          content:
            application/json:
              schema:
                type: object
                required:
                  - status
                  - message
                properties:
                  status:
                    type: string
                    enum:
                      - error
                  message:
                    type: string
              example:
                status: error
                message: >-
                  No speech-to-text provider is configured; send a transcript
                  instead
          headers: {}
          x-apidog-name: Audio was sent but speech recognition is off on this deploym
      security:
        - CallerAPI Key: []
          x-apidog:
            schemeGroups:
              - id: 7Wgpz7XqJ5wdLyzsKr91e
                schemeIds:
                  - CallerAPI Key
            required: true
            use:
              id: 7Wgpz7XqJ5wdLyzsKr91e
      x-apidog-folder: Spam protection/Voice firewall/REST
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/1027392/apis/api-43843796-run
components:
  schemas: {}
  securitySchemes:
    CallerAPI Key:
      type: apikey
      in: header
      name: x-auth
    ApiKeyAuth:
      type: apikey
      in: header
      name: X-Auth
      description: CallerAPI API key (UUID).
servers:
  - url: https://api.callerapi.com
    description: Prod Env
security:
  - CallerAPI Key: []
    x-apidog:
      schemeGroups:
        - id: 7Wgpz7XqJ5wdLyzsKr91e
          schemeIds:
            - CallerAPI Key
      required: true
      use:
        id: 7Wgpz7XqJ5wdLyzsKr91e

```
