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

# List P45 extracts

> Retrieve paginated P45 scan extracts for a given user. Each document
includes the extracted P45 data, the extraction
probability, and details of the underlying uploaded document.

Extracts collected under an authorisation that has since been
revoked are not returned. Expired authorisations do not hide them.




## OpenAPI

````yaml GET /p45/{user_id}
openapi: 3.0.1
info:
  title: Payroll API
  description: A full flagged payroll api provided by Teal
  version: 1.0.0
servers:
  - url: https://api.sandbox.goteal.co
    description: Sandbox server for experiments
  - url: https://api.goteal.co
    description: Production server
security:
  - ApiKeyAuth: []
  - MemberBearerAuth: []
paths:
  /p45/{user_id}:
    get:
      summary: Returns all P45 extracts for a user
      description: |
        Retrieve paginated P45 scan extracts for a given user. Each document
        includes the extracted P45 data, the extraction
        probability, and details of the underlying uploaded document.

        Extracts collected under an authorisation that has since been
        revoked are not returned. Expired authorisations do not hide them.
      parameters:
        - in: path
          name: user_id
          schema:
            type: string
            format: uuid
          required: true
          description: ID of the user to get P45 extracts for
        - name: offset
          in: query
          description: The offset to start at
          required: false
          schema:
            type: integer
            format: int64
            minimum: 0
            default: 0
        - name: limit
          in: query
          description: The number of items to return
          required: false
          schema:
            type: integer
            format: int64
            minimum: 1
            maximum: 1000
            default: 100
        - name: created_after
          in: query
          description: Filter out documents created before the given date
          required: false
          schema:
            type: string
            format: date-time
            example: '2024-01-01T00:00:00.000Z'
        - name: created_before
          in: query
          description: Filter out documents created after the given date
          required: false
          schema:
            type: string
            format: date-time
            example: '2024-12-31T23:59:59.000Z'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  pagination:
                    $ref: '#/components/schemas/Pagination'
                  documents:
                    type: array
                    items:
                      $ref: '#/components/schemas/DocScanDocument'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/UnauthorizedApiKey'
        '404':
          $ref: '#/components/responses/ResourceNotFound'
components:
  schemas:
    Pagination:
      type: object
      required:
        - offset
        - limit
        - count
      properties:
        offset:
          description: The offset to start at - zero based
          type: integer
          format: int32
          minimum: 1
          default: 0
          example: 75
        limit:
          type: integer
          format: int32
          minimum: 1
          maximum: 100
          default: 20
          example: 25
        count:
          type: integer
          format: int32
          example: 14
          minimum: 0
        total_count:
          type: integer
          format: int32
          example: 89
    DocScanDocument:
      type: object
      required:
        - id
        - type
        - created_at
        - document_id
        - extract
        - probability
      properties:
        id:
          type: string
          format: uuid
          description: Unique doc scan extract identifier
          example: 95a0e70b-fe02-4f47-aef9-2efff279df71
        type:
          type: string
          description: The requested document type
          enum:
            - p45
            - p60
            - universal_credit
          example: p45
        created_at:
          $ref: '#/components/schemas/Date'
        document_id:
          type: string
          format: uuid
          description: ID of the linked raw document
        document_external_id:
          type: string
          description: External ID provided during upload, if any
          nullable: true
        document_filename:
          type: string
          description: File name of the uploaded document
          nullable: true
        extract:
          type: object
          description: >-
            Extracted fields for the document type (see DocScanP45Extract,
            DocScanP60Extract or DocScanUniversalCreditExtract)
          oneOf:
            - $ref: '#/components/schemas/DocScanP45Extract'
            - $ref: '#/components/schemas/DocScanP60Extract'
            - $ref: '#/components/schemas/DocScanUniversalCreditExtract'
        probability:
          type: number
          format: float
          description: Confidence score (0-1) of the extraction
          example: 0.95
        provenance:
          type: object
          description: >-
            Which pipeline produced the extract and the fraud-scan verdict on
            the source PDF. Omitted when no provenance was recorded.
          nullable: true
          required:
            - source
            - trust_score
          properties:
            source:
              type: string
              description: The extraction pipeline that produced this document
              enum:
                - DOC_SCAN
              example: DOC_SCAN
            trust_score:
              $ref: '#/components/schemas/TrustScore'
    Date:
      type: string
      format: date-time
      example: '2019-05-17T00:00:00.000Z'
    DocScanP45Extract:
      type: object
      description: Fields extracted from a P45
      properties:
        employer_name:
          type: string
          nullable: true
          example: Acme Corporation
        paye_reference:
          type: string
          nullable: true
          example: 123/AB456
        employee_name:
          type: string
          nullable: true
          example: John Smith
        national_insurance_number:
          type: string
          nullable: true
          example: QQ123456C
        leave_date:
          type: string
          description: Date in YYYY-MM-DD format
          nullable: true
          example: '2024-05-31'
        tax_code:
          type: string
          nullable: true
          example: 1257L
        tax_year:
          type: string
          description: >-
            Start year of the UK tax year the leave date falls in (`2024` for
            2024-25). Derived from `leave_date`; `null` when the leave date is
            missing.
          nullable: true
          example: '2024'
        gross_pay:
          type: string
          description: Monetary value as a string with 2 decimals
          nullable: true
          example: '1500.00'
        income_tax:
          type: string
          description: Monetary value as a string with 2 decimals
          nullable: true
          example: '250.00'
    DocScanP60Extract:
      type: object
      description: Fields extracted from a P60
      properties:
        employer_name:
          type: string
          nullable: true
          example: Acme Corporation
        paye_reference:
          type: string
          nullable: true
          example: 123/AB456
        employee_name:
          type: string
          nullable: true
          example: John Smith
        national_insurance_number:
          type: string
          nullable: true
          example: QQ123456C
        tax_year:
          type: string
          description: >-
            Start year of the UK tax year (`2025` for 2025-26, the year ending 5
            April 2026).
          example: '2025'
        tax_code:
          type: string
          nullable: true
          example: 1257L
        gross_pay:
          type: string
          description: >-
            Total pay for the year across all employments, as a string with 2
            decimals
          example: '32000.00'
        income_tax:
          type: string
          description: >-
            Total tax for the year across all employments, as a string with 2
            decimals
          nullable: true
          example: '5000.00'
        employee_ni:
          type: string
          description: Monetary value as a string with 2 decimals
          nullable: true
          example: '2500.00'
    DocScanUniversalCreditExtract:
      type: object
      description: Fields extracted from a Universal Credit statement
      properties:
        claimant_name:
          type: string
          nullable: true
          example: John Smith
        monthly_amount:
          type: string
          description: Monetary value as a string with 2 decimals
          nullable: true
          example: '1200.00'
        assessment_period:
          type: string
          description: Assessment period in YYYY-MM-DD to YYYY-MM-DD format
          nullable: true
          example: 2024-05-06 to 2024-06-05
    TrustScore:
      type: string
      description: >-
        The document trust score assessment. Trust score will be present if the
        payroll data is coming from a payslip source
      enum:
        - Low
        - Medium
        - High
      example: High
    Error:
      required:
        - errors
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
          description: An array of messages describing the errors
          example:
            - The request is missing the required field `name`
    Unauthorized:
      type: object
      properties:
        errors:
          type: string
          description: An array of messages describing the errors
          example:
            - No X-API-KEY header provided or wrong value
    NotFound:
      type: object
      properties:
        errors:
          type: string
          description: An array of messages describing the not found errors
          example:
            - >-
              The resource with id [8be3bb60-5ab4-4bd2-90e6-3b015691a827] does
              not exist
  responses:
    BadRequest:
      description: Bad request if one of the required parameters is missing
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnauthorizedApiKey:
      description: Unauthorized if the X-API-KEY is not provided or is wrong
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Unauthorized'
    ResourceNotFound:
      description: Resource not found
      content:
        applcation/json:
          schema:
            $ref: '#/components/schemas/NotFound'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    MemberBearerAuth:
      type: http
      scheme: bearer
      description: >-
        Bearer token for authentication. The token should be the one returned by
        the "/members/signin"

````

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