Smart Pension Contributions API

The Contributions API from Smart Pension — 2 operation(s) for contributions.

OpenAPI Specification

smart-pension-contributions-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Keystone Contributions API
  version: v12
  description: This is the endpoint description of Keystone API.
servers:
- url: https://api.sandbox.autoenrolment.co.uk
- url: /
tags:
- name: Contributions
paths:
  /companies/{company_id}/employees/{employee_id}/contributions:
    post:
      summary: Contributions/Create
      tags:
      - Contributions
      security:
      - oAuth2:
        - user
        - customer
      parameters:
      - name: employee_id
        in: path
        required: true
        example: 216
        schema:
          type: string
      - name: company_id
        in: path
        required: true
        example: 477
        schema:
          type: string
      requestBody:
        content:
          application/json:
            examples:
              valid_request:
                value:
                  gross_qualifying_earnings: 1200
                  pensionable_earnings: 1000
                  period_type: Monthly
                  category: Eligible jobholders
                  employee_amount: 0
                  company_amount: 0
                  voluntary_amount: 0
                  starts_on: '2020-09-01'
                  ends_on: '2020-09-30'
              valid_request_using_money_in_definition:
                value:
                  gross_qualifying_earnings: 1200
                  pensionable_earnings: 1000
                  period_type: Monthly
                  category: Eligible jobholders
                  contribution_amounts:
                  - display_name: Employer Contributions
                    percentage: 3
                  - display_name: Employee Contributions
                    percentage: 5
                  starts_on: '2020-09-01'
                  ends_on: '2020-09-30'
              invalid_parameters:
                value:
                  gross_qualifying_earnings: ''
              self_certified_company_valid_request:
                value:
                  gross_qualifying_earnings: 1200
                  pensionable_earnings: 1000
                  period_type: Monthly
                  category: Eligible jobholders
                  employee_amount: 0
                  company_amount: 0
                  voluntary_amount: 0
                  starts_on: '2020-09-01'
                  ends_on: '2020-09-30'
            schema:
              type: object
              properties:
                starts_on:
                  type: string
                ends_on:
                  type: string
                period_type:
                  type: string
                category:
                  type: string
                  enum:
                  - No duties
                  - Entitled workers
                  - Non-eligible jobholders
                  - Eligible jobholders
                contribution_type:
                  type: string
                  enum:
                  - regular
                type:
                  type: string
                  enum:
                  - regular
                pensionable_earnings:
                  type: number
                gross_qualifying_earnings:
                  type: number
                second_gross_qualifying_earnings_amount:
                  type: number
                unusual_amount_reason:
                  type: string
                  enum:
                  - parental_leave
                  - sick_leave
                  - other_leave
                  - taa
                  - mpaa
                  - fixed_amount
                  - additional_funds
                  - payment_holiday
                  - other_scheme
                  - not_expected
                company_amount:
                  type: number
                employee_amount:
                  type: number
                employee_percentage:
                  type: number
                company_percentage:
                  type: number
                avc_percentage:
                  type: number
                voluntary_amount:
                  type: number
      responses:
        '201':
          description: Creates a contribution with pensionable earnings and amounts
          content:
            application/json:
              examples:
                valid_request:
                  value:
                    id: 50
                    category: Eligible jobholders
                    employee_id: 210
                    period_type: Monthly
                    gross_qualifying_earnings: 1200
                    second_gross_qualifying_earnings_amount: null
                    pensionable_earnings: 1000
                    employee_pensionable_earnings_amount: 1000
                    employer_pensionable_earnings_amount: 1000
                    company_percentage: 11
                    employee_percentage: 10
                    avc_percentage: null
                    state: created
                    created_at: '2020-09-01T00:00:00.000+01:00'
                    updated_at: '2020-09-01T00:00:00.000+01:00'
                    contribute_if_entitled: true
                    company_amount: 0
                    employee_amount: 0
                    voluntary_amount: 0
                    total_amount: 0
                    currency: GBP
                    works_in_uk: true
                    starts_on: '2020-09-01'
                    ends_on: '2020-09-30'
                    lower_level: 520
                    upper_level: 4189
                    trigger_level: 833
                    pensionable_earning_type: unbanded
                    contribution_type: regular
                    uuid: fbcb1aa6-d8de-434f-9bf4-48e3f9034613
                    company_name: nonummy maecenas 579
                    contribution_amounts:
                    - id: 149
                      display_name: Employee Contributions
                      amount: 0
                      currency: GBP
                      source_type: employee
                      state: created
                    - id: 148
                      display_name: Employer Contributions
                      amount: 0
                      currency: GBP
                      source_type: employer
                      state: created
                    - id: 150
                      display_name: Additional Voluntary Contributions
                      amount: 0
                      currency: GBP
                      source_type: other_avc
                      state: created
                    links:
                    - rel: employee
                      title: employee
                      href: https://api.host.com/companies/462/employees/210
                valid_request_using_money_in_definition:
                  value:
                    id: 51
                    category: Eligible jobholders
                    employee_id: 212
                    period_type: Monthly
                    gross_qualifying_earnings: 1200
                    second_gross_qualifying_earnings_amount: null
                    pensionable_earnings: 1000
                    employee_pensionable_earnings_amount: null
                    employer_pensionable_earnings_amount: null
                    company_percentage: 3
                    employee_percentage: 5
                    avc_percentage: null
                    state: created
                    created_at: '2020-09-01T00:00:00.000+01:00'
                    updated_at: '2020-09-01T00:00:00.000+01:00'
                    contribute_if_entitled: true
                    company_amount: 30
                    employee_amount: 50
                    voluntary_amount: 0
                    total_amount: 80
                    currency: GBP
                    works_in_uk: true
                    starts_on: '2020-09-01'
                    ends_on: '2020-09-30'
                    lower_level: 520
                    upper_level: 4189
                    trigger_level: 833
                    pensionable_earning_type: unbanded
                    contribution_type: regular
                    uuid: 3ad6fe2a-51ac-4da6-b6d9-759a15406a10
                    company_name: sodales scelerisque 589
                    contribution_amounts:
                    - id: 152
                      display_name: Employee Contributions
                      amount: 50
                      currency: GBP
                      source_type: employee
                      state: created
                    - id: 151
                      display_name: Employer Contributions
                      amount: 30
                      currency: GBP
                      source_type: employer
                      state: created
                    links:
                    - rel: employee
                      title: employee
                      href: https://api.host.com/companies/467/employees/212
                self_certified_company_valid_request:
                  value:
                    id: 52
                    category: Eligible jobholders
                    employee_id: 216
                    period_type: Monthly
                    gross_qualifying_earnings: 1200
                    second_gross_qualifying_earnings_amount: null
                    pensionable_earnings: 1000
                    employee_pensionable_earnings_amount: 1000
                    employer_pensionable_earnings_amount: 1000
                    company_percentage: 11
                    employee_percentage: 10
                    avc_percentage: null
                    state: created
                    created_at: '2020-09-01T00:00:00.000+01:00'
                    updated_at: '2020-09-01T00:00:00.000+01:00'
                    contribute_if_entitled: true
                    company_amount: 0
                    employee_amount: 0
                    voluntary_amount: 0
                    total_amount: 0
                    currency: GBP
                    works_in_uk: true
                    starts_on: '2020-09-01'
                    ends_on: '2020-09-30'
                    lower_level: 520
                    upper_level: 4189
                    trigger_level: 833
                    pensionable_earning_type: tier1
                    contribution_type: regular
                    uuid: 45be7546-97be-4740-98cd-bed56b7487bd
                    company_name: massa id 609
                    contribution_amounts:
                    - id: 154
                      display_name: Employee Contributions
                      amount: 0
                      currency: GBP
                      source_type: employee
                      state: created
                    - id: 153
                      display_name: Employer Contributions
                      amount: 0
                      currency: GBP
                      source_type: employer
                      state: created
                    - id: 155
                      display_name: Additional Voluntary Contributions
                      amount: 0
                      currency: GBP
                      source_type: other_avc
                      state: created
                    links:
                    - rel: employee
                      title: employee
                      href: https://api.host.com/companies/477/employees/216
              schema:
                $ref: '#/components/schemas/response_contribution'
        '403':
          description: Forbidden self_certified
          content:
            application/json:
              examples:
                forbidden_self_certified:
                  value:
                    errors:
                    - code: 21
                      title: Contribution cannot be created.
                      detail: The contribution cannot be created as the company pensionable earning type is self-certification, and the contribution does not have the amounts calculated.
                      form: null
                      attribute: base
                      error: create_not_calculated_self_certification_contribution
                      meta: {}
                      source:
                        pointer: /base
        '422':
          description: Invalid parameters
          content:
            application/json:
              examples:
                invalid_parameters:
                  value:
                    errors:
                    - code: 613
                      title: Pay period start date is a required field.
                      detail: You need to enter a pay period start date.
                      meta: {}
                      source:
                        pointer: /data/attributes/starts_on
                    - code: 619
                      title: Pay period end date is a required field.
                      detail: The pay period end date must be present and must be a valid date.
                      meta: {}
                      source:
                        pointer: /data/attributes/ends_on
                    - code: 611
                      title: Period type is a required field.
                      detail: You need to enter a pay period type.
                      meta: {}
                      source:
                        pointer: /data/attributes/period_type
                    - code: 612
                      title: Period type is not valid.
                      detail: 'Valid values for the period types are: Weekly, Fortnightly, FourWeekly, Monthly, Quarterly, BiAnnually, Annually.'
                      meta:
                        values:
                        - Weekly
                        - Fortnightly
                        - FourWeekly
                        - Monthly
                        - Quarterly
                        - BiAnnually
                        - Annually
                        value: null
                      source:
                        pointer: /data/attributes/period_type
                    - code: 607
                      title: Gross qualifying earnings is missing.
                      detail: Enter gross qualifying earnings.
                      meta: {}
                      source:
                        pointer: /data/attributes/gross_qualifying_earnings
    get:
      summary: Contributions/List
      tags:
      - Contributions
      security:
      - oAuth2:
        - user
        - customer
      parameters:
      - name: company_id
        in: path
        required: true
        example: 492
        schema:
          type: string
      - name: employee_id
        in: path
        required: true
        example: 225
        schema:
          type: string
      - name: limit
        in: query
        schema:
          type: integer
        required: false
      - name: offset
        in: query
        schema:
          type: integer
        required: false
      - name: sort
        in: query
        schema:
          type: string
        required: false
      - name: direction
        in: query
        schema:
          type: string
          enum:
          - ASC
          - DESC
        required: false
      - name: filter
        in: query
        schema:
          type: object
          properties:
            state:
              type: array
              items:
                type: string
            assessment:
              type: object
              properties:
                category:
                  type: string
            period_type:
              type: array
              items:
                type: string
            starts_on:
              type: array
              items:
                type: string
            ends_on:
              type: array
              items:
                type: string
        required: false
        style: deepObject
      - name: include[]
        in: query
        schema:
          type: array
          items:
            enum:
            - assessment
        required: false
      - name: operator
        in: query
        schema:
          type: string
          enum:
          - or
          - and
        required: false
      responses:
        '200':
          description: Success
          content:
            application/json:
              example:
                limit: 50
                offset: 0
                total: 0
                links:
                - rel: self
                  title: self
                  href: http://api.host.com/companies/492/employees/225/contributions
                - rel: first
                  title: first
                  href: http://api.host.com/companies/492/employees/225/contributions?offset=0&limit=50
                - rel: last
                  title: last
                  href: http://api.host.com/companies/492/employees/225/contributions?offset=0&limit=50
                contributions: []
              schema:
                type: object
                properties:
                  limit:
                    type:
                    - integer
                    - 'null'
                  offset:
                    type:
                    - integer
                    - 'null'
                  total:
                    type:
                    - integer
                    - 'null'
                  links:
                    type: array
                    items:
                      $ref: '#/components/schemas/link'
                  contributions:
                    type:
                    - array
                    - 'null'
                    items:
                      $ref: '#/components/schemas/response_contribution'
  /companies/{company_id}/employees/{employee_id}/contributions/{id}:
    delete:
      summary: Contributions/Destroy
      tags:
      - Contributions
      security:
      - oAuth2:
        - user
        - customer
      parameters:
      - name: id
        in: path
        required: true
        example: 53
        schema:
          type: string
      - name: company_id
        in: path
        required: true
        example: 487
        schema:
          type: string
      - name: employee_id
        in: path
        required: true
        example: 220
        schema:
          type: string
      responses:
        '204':
          description: Success
        '403':
          description: Forbidden when the contribution is in the payment/investment cycle
          content:
            application/json:
              examples:
                forbidden_contribution_cycle:
                  value:
                    errors:
                    - code: 2
                      title: Contribution cannot be deleted.
                      detail: The contribution cannot be deleted as it has been paid or payment is pending and a permanent record must be kept.
                      form: null
                      attribute: base
                      error: destroy_frozen_contribution
                      meta: {}
                      source:
                        pointer: /base
        '404':
          description: Not Found
          content:
            application/json:
              examples:
                not_found:
                  value: ''
    get:
      summary: Contributions/Get
      tags:
      - Contributions
      security:
      - oAuth2:
        - user
        - customer
      parameters:
      - name: id
        in: path
        required: true
        example: 56
        schema:
          type: string
      - name: company_id
        in: path
        required: true
        example: 490
        schema:
          type: string
      - name: employee_id
        in: path
        required: true
        example: 223
        schema:
          type: string
      - name: include[]
        in: query
        schema:
          type: array
          items:
            enum:
            - employee
        required: false
      responses:
        '200':
          description: Success
          content:
            application/json:
              example:
                id: 56
                category: Non-eligible jobholders
                employee_id: 223
                period_type: Weekly
                gross_qualifying_earnings: 1000
                second_gross_qualifying_earnings_amount: null
                pensionable_earnings: 10
                employee_pensionable_earnings_amount: null
                employer_pensionable_earnings_amount: null
                company_percentage: 10
                employee_percentage: 10
                avc_percentage: null
                state: created
                created_at: '2026-08-05T13:00:23.000+01:00'
                updated_at: '2026-08-05T13:00:23.000+01:00'
                contribute_if_entitled: true
                company_amount: 100
                employee_amount: 100
                life_cover_amount: 0
                voluntary_amount: 0
                total_amount: 200
                currency: GBP
                works_in_uk: true
                starts_on: '2026-08-01'
                ends_on: '2026-08-08'
                lower_level: null
                upper_level: null
                trigger_level: null
                pensionable_earning_type: banded
                contribution_type: regular
                uuid: 89b952b9-930d-4a5d-80ca-084fd88f9969
                company_name: lorem ipsum 635
                contribution_amounts:
                - id: 166
                  display_name: RegularContribution_ER
                  amount: 100
                  currency: GBP
                  source_type: employee
                  state: created
                - id: 165
                  display_name: RegularContribution_ER
                  amount: 100
                  currency: GBP
                  source_type: employer
                  state: created
                - id: 167
                  display_name: RegularContribution_ER
                  amount: 0
                  currency: GBP
                  source_type: other_avc
                  state: created
                links:
                - rel: employee
                  title: employee
                  href: https://api.host.com/companies/490/employees/223
              schema:
                $ref: '#/components/schemas/response_contribution'
        '404':
          description: Not Found
    put:
      summary: Contributions/Update
      tags:
      - Contributions
      security:
      - oAuth2:
        - user
        - customer
      parameters:
      - name: id
        in: path
        required: true
        example: 74
        schema:
          type: string
      - name: company_id
        in: path
        required: true
        example: 526
        schema:
          type: string
      - name: employee_id
        in: path
        required: true
        example: 241
        schema:
          type: string
      requestBody:
        content:
          application/json:
            examples:
              valid_parameters_using_money_in_definition_with_amount_format:
                value:
                  contribution_amounts:
                  - display_name: RegularContribution_ER
                    amount: 100
                  - display_name: RegularContribution_EE
                    amount: 250
                  - display_name: RegularContribution_AVC
                    amount: 0
              valid_parameters_using_money_in_definition_with_percentage_format:
                value:
                  contribution_amounts:
                  - display_name: RegularContribution_ER
                    amount: 100
                    percentage: 10
                  - display_name: RegularContribution_EE
                    amount: 50
                    percentage: 5
                  - display_name: RegularContribution_AVC
                    amount: 0
                    percentage: 0
              valid_parameters_regular_contribution:
                value:
                  gross_qualifying_earnings: 1500
                  voluntary_amount: 10
                  company_amount: 100
                  employee_amount: 10
              forbidden_category_change:
                value:
                  gross_qualifying_earnings: 1
                  category: Entitled workers
                  voluntary_amount: 10
                  company_amount: 100
                  employee_amount: 1
              valid_parameters_single_contribution:
                value:
                  voluntary_amount: 10
            schema:
              anyOf:
              - type: object
                properties:
                  gross_qualifying_earnings:
                    type: number
                  second_gross_qualifying_earnings_amount:
                    type: number
                  company_amount:
                    type: number
                  company_percentage:
                    type: number
                  employee_amount:
                    type: number
                  employee_percentage:
                    type: number
                  avc_percentage:
                    type: number
                  voluntary_amount:
                    type: number
                  pensionable_earnings:
                    type: number
              - type: object
                properties:
                  company_amount:
                    type: number
                  employee_amount:
                    type: number
                  voluntary_amount:
                    type: number
              - type: object
                properties:
                  gross_qualifying_earnings:
                    type: number
                  second_gross_qualifying_earnings_amount:
                    type: number
                  contribution_amounts:
                    type: array
                    items:
                      type: object
                      properties:
                        display_name:
                          type: string
                        amount:
                          type: number
                        percentage:
                          type: number
                      required:
                      - display_name
                  pensionable_earnings:
                    type: number
              - type: object
                properties:
                  contribution_amounts:
                    type: array
                    items:
                      type: object
                      properties:
                        display_name:
                          type: string
                        amount:
                          type: number
                        percentage:
                          type: number
                      required:
                      - display_name
      responses:
        '204':
          description: Updates a contribution
        '403':
          description: Forbidden when the contribution category changes
          content:
            application/json:
              examples:
                forbidden_contribution_paid:
                  value:
                    errors:
                    - code: 10
                      title: Contribution cannot be updated.
                      detail: This contribution has been paid or payment is pending. Contact support if you still need to update the contribution.
                      form: null
                      attribute: base
                      error: update_frozen_contribution
                      meta: {}
                      source:
                        pointer: /base
                forbidden_category_change:
                  value:
                    errors:
                    - code: 42
                      title: Contribution cannot be updated.
                      detail: This contribution cannot be updated because the new amount will change the assessment category for this employee. Please delete and recreate this contribution.
                      form: null
                      attribute: base
                      error: update_with_category_change
                      meta: {}
                      source:
                        pointer: /base
        '404':
          description: Not Found
    patch:
      summary: Contributions/Update
      tags:
      - Contributions
      security:
      - oAuth2:
        - user
        - customer
      parameters:
      - name: id
        in: path
        required: true
        example: 81
        schema:
          type: string
      - name: company_id
        in: path
        required: true
        example: 559
        schema:
          type: string
      - name: employee_id
        in: path
        required: true
        example: 253
        schema:
          type: string
      requestBody:
        content:
          application/json:
            examples:
              valid_parameters_using_money_in_definition_with_amount_format:
                value:
                  contribution_amounts:
                  - display_name: RegularContribution_ER
                    amount: 100
                  - display_name: RegularContribution_EE
                    amount: 250
                  - display_name: RegularContribution_AVC
                    amount: 0
              valid_parameters_using_money_in_definition_with_percentage_format:
                value:
                  contribution_amounts:
                  - display_name: RegularContribution_ER
                    amount: 100
                    percentage: 10
                  - display_name: RegularContribution_EE
                    amount: 50
                    percentage: 5
                  - display_name: RegularContribution_AVC
                    amount: 0
                    percentage: 0
              valid_parameters_regular_contribution:
                value:
                  gross_qualifying_earnings: 1500
                  voluntary_amount: 10
                  company_amount: 100
                  employee_amount: 10
              forbidden_category_change:
                value:
                  gross_qualifying_earnings: 1
                  category: Entitled workers
                  voluntary_amount: 10
                  company_amount: 100
                  employee_amount: 1
              valid_parameters_single_contribution:
                value:
                  voluntary_amount: 10
            schema:
              anyOf:
              - type: object
                properties:
                  gross_qualifying_earnings:
                    type: number
                  second_gross_qualifying_earnings_amount:
                    type: number
                  company_amount:
                    type: number
                  company_percentage:
                    type: number
                  employee_amount:
                    type: number
                  employee_percentage:
                    type: number
                  avc_percentage:
                    type: number
                  voluntary_amount:
                    type: number
                  pensionable_earnings:
                    type: number
              - type: object
                properties:
                  company_amount:
                    type: number
                  employee_amount:
                    type: number
                  voluntary_amount:
                    type: number
              - type: object
                properties:
                  gross_qualifying_earnings:
                    type: number
                  second_gross_qualifying_earnings_amount:
                    type: number
                  contribution_amounts:
                    type: array
                    items:
                      type: object
                      properties:
                        display_name:
                          type: string
                        amount:
                          type: number
                        percentage:
                          type: number
                      required:
                      - display_name
                  pensionable_earnings:
                    type: number
              - type: object
                properties:
                  contribution_amounts:
                    type: array
                    items:
                      type: object
                      properties:
                        display_name:
                          type: string
                        amount:
                          type: number
                        percentage:
                          type: number
                      required:
                      - displ

# --- truncated at 32 KB (100 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/smart-pension/refs/heads/main/openapi/smart-pension-contributions-api-openapi.yml