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

# Record Prediction Outcome

> Records the actual outcome of a previously predicted transaction.

This feedback loop improves prediction accuracy over time. Call this after every transaction you pre-screened with `/predict/risk`.




## OpenAPI

````yaml /api-reference/openapi.yaml post /api/predict/outcome
openapi: 3.0.3
info:
  title: Revtain API
  description: >
    Recover failed payments. No checkout changes. Works with your existing
    payment stack.


    ## Choose Your Path


    **Using Chargebee, Recurly, Stripe Billing, Braintree, Zuora, or Shopify
    (ReCharge)?**

    Use a Connector — paste one webhook URL, no code, 5 minutes.


    **Custom billing system or want full API control?**

    Use the Recovery Engine directly. The quickstart gets you to a working
    recovery call in 60 seconds.


    ## Authentication


    Pass your API key via the `X-API-KEY` header on all requests:


    ```

    X-API-KEY: rev_dTviCg52T8gLPCjrrW4KA0NKf_f5pQgk

    ```


    Keep this secret. Your API key can trigger charges. Never expose it in
    client-side code, public repos, or logs.


    ## Base URL


    ```

    https://api.revtain.com

    ```


    Same URL for testing and production. Test mode is controlled by your gateway
    type — onboard with a test gateway (e.g., Stripe `sk_test_...`) for sandbox,
    live key for production.
  version: 1.0.0
  contact:
    email: support@revtain.com
servers:
  - url: https://api.revtain.com
    description: Production & Sandbox (test mode controlled by gateway key)
security:
  - ApiKeyAuth: []
tags:
  - name: Recovery Engine
    description: Trigger and track payment recovery attempts
  - name: Predictive Risk Engine
    description: Pre-screen payments before they fail
  - name: Retention
    description: Hosted cancel flow to reduce voluntary churn
  - name: Health
    description: Service health check
paths:
  /api/predict/outcome:
    post:
      tags:
        - Predictive Risk Engine
      summary: Record Prediction Outcome
      description: >
        Records the actual outcome of a previously predicted transaction.


        This feedback loop improves prediction accuracy over time. Call this
        after every transaction you pre-screened with `/predict/risk`.
      operationId: recordOutcome
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RecordOutcomeRequest'
            example:
              paymentMethodToken: pm_1234567890
              actualOutcome: succeeded
      responses:
        '200':
          description: Outcome recorded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordOutcomeResponse'
              example:
                success: true
                predictionId: pred_a1b2c3d4e5f6
                predictedRecommendation: proceed_with_caution
                actual: succeeded
                accurate: true
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
components:
  schemas:
    RecordOutcomeRequest:
      type: object
      required:
        - paymentMethodToken
        - actualOutcome
      properties:
        paymentMethodToken:
          type: string
          description: The same token used in the `/predict/risk` call.
          example: pm_1234567890
        actualOutcome:
          type: string
          enum:
            - succeeded
            - failed
            - blocked
          description: What actually happened.
          example: succeeded
    RecordOutcomeResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        predictionId:
          type: string
          example: pred_a1b2c3d4e5f6
        predictedRecommendation:
          type: string
          example: proceed_with_caution
        actual:
          type: string
          enum:
            - succeeded
            - failed
            - blocked
          description: >-
            The outcome you reported in the request (echoed back so you can
            correlate).
          example: succeeded
        accurate:
          type: boolean
          description: >-
            Whether the prediction matched the actual outcome — feeds the
            model's accuracy tracking.
          example: true
    ValidationError:
      type: object
      properties:
        error:
          type: string
          example: Validation failed.
        details:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
          example:
            paymentMethodToken:
              - Payment method token is required
            amount:
              - Amount must be a positive number
    UnauthorizedError:
      type: object
      properties:
        error:
          type: string
          example: Unauthorized. Missing or invalid API key.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: 'Your Revtain API key (format: `rev_xxx`). Provided during onboarding.'

````