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

# Get a transaction by ID

> Returns a single Transaction from a given transactionId.



## OpenAPI

````yaml /openapi/integration-api-v2/openapi.yaml get /v2/transactions/{id}
openapi: 3.0.0
info:
  title: Spirii API
  description: Spirii API
  version: 2.10.0
  contact: {}
servers:
  - url: https://api.spirii.com
security: []
tags: []
paths:
  /v2/transactions/{id}:
    get:
      tags:
        - Transactions v2
      summary: Get a transaction by ID
      description: Returns a single Transaction from a given transactionId.
      operationId: getTransactionByID
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the transaction.
          schema:
            example: 12345678
            type: number
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
        '400':
          description: Bad Request provided. A message will describe the issue.
        '403':
          description: Authorization Spirii API Key invalid or not provided.
        '404':
          description: Transaction with provided ID was not found.
        '502':
          description: Bad Gateway response.
      security:
        - Authorization: []
components:
  schemas:
    Transaction:
      type: object
      properties:
        auth:
          $ref: '#/components/schemas/AuthDetails'
        chargeBoxId:
          type: integer
          description: ID of the ChargeBox..
        chargingDetails:
          $ref: '#/components/schemas/ChargingDetails'
        company:
          $ref: '#/components/schemas/CompanyDetails'
        duration:
          description: >-
            Duration of the transaction. Unit of measure is seconds. This object
            is not dynamic and it is only generated on when the transaction
            ends.
          allOf:
            - $ref: '#/components/schemas/Duration'
        evseId:
          type: string
          example: FR.SPI.Z000001*1
        id:
          type: integer
          example: 123456
        isRoaming:
          type: boolean
        isPriority:
          type: boolean
          description: Flag signalling if this is a priority transaction
        location:
          $ref: '#/components/schemas/Location'
        paymentMethod:
          type: string
          enum:
            - PaymentTerminal
            - RoamingOperator
            - Stripe
            - MobilePay
            - Free
            - System
            - Invoice
            - Unknown
        paymentStatus:
          type: string
          enum:
            - succeeded
            - unknown
            - mobilepay
            - canceled
            - expired
            - n/a
            - paid
            - pending
        price:
          $ref: '#/components/schemas/Price'
        startedAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        appUserId:
          type: integer
          description: >-
            ID of an App User. This property can be null if the authenticated
            user is no registered to any app.
        endedAt:
          type: string
          format: date-time
        roamingDetails:
          oneOf:
            - $ref: '#/components/schemas/RoamingDetailsHubject'
            - $ref: '#/components/schemas/RoamingDetailsOCPI'
        tariff:
          description: Value is `null` when no tariff is applied, e.g. Free transaction.
          allOf:
            - $ref: '#/components/schemas/Tariff'
        voucher:
          $ref: '#/components/schemas/Voucher'
        voucherGroup:
          $ref: '#/components/schemas/VoucherGroup'
      required:
        - auth
        - chargeBoxId
        - chargingDetails
        - company
        - duration
        - evseId
        - id
        - isRoaming
        - location
        - paymentMethod
        - paymentStatus
        - price
        - startedAt
        - updatedAt
    AuthDetails:
      type: object
      properties:
        name:
          type: string
          enum:
            - OCPI - RFID authorized
            - App - Stripe
            - App - Mobile Pay
            - App - Virtual RFID
            - Auto Charge
            - Payment Terminal
            - RFID (Physical)
            - Plug & Charge
            - Unauthorized
            - Hubject - RemoteStart from EMP
            - Hubject - RFID authorised by EMP
            - Auth. Disabled
            - Hubject - RemoteStart from Spirii
            - unknown
          description: >-
            The name of the authorisation to determine how the charging session
            was authorised.
        type:
          type: string
          enum:
            - App
            - RFID
            - PaymentTerminal
            - PlugAndCharge
            - AutoCharge
            - OpenChargeBox
            - Unauthorized
            - Unknown
          description: Type (family) of authorisation method.
        idTag:
          description: >-
            Object containing details on the token (also known as charge keys or
            IdTags) used to start charging.
          allOf:
            - $ref: '#/components/schemas/IdTagDetails'
    ChargingDetails:
      type: object
      properties:
        consumed:
          type: number
          description: Consumed energy in KWh.
          format: float
        chargingStatus:
          type: string
          description: Status of the charging session.
          enum:
            - Charging
            - Preparing
            - Finishing
            - Paused
            - Finished
            - Unknown
        vehicleStateOfCharge:
          type: object
          description: >-
            Values of this object can be null if vehicle or other equipment does
            not report this data.
        meterStart:
          type: number
          description: >-
            This is the first meter value provided by the charger when a
            StartTransaction call is received.
          format: float
        meterStop:
          type: number
          description: >-
            This is the last meter value provided by the charger when a
            StopTransaction call is received.
          format: float
        co2Emitted:
          type: number
          description: CO2 emitted in Tonnes (1000kg).
          format: float
        highestPowerDrawn:
          type: number
          description: Highest amount of power drawn in KW.
          format: float
      required:
        - consumed
        - chargingStatus
        - meterStart
        - meterStop
        - co2Emitted
        - highestPowerDrawn
    CompanyDetails:
      type: object
      properties:
        id:
          type: integer
          description: Company ID
          example: 123456
        name:
          type: string
          description: Company name.
          example: Spirii
      required:
        - id
        - name
    Duration:
      type: object
      properties:
        charging:
          type: integer
          description: Duration time while charging in seconds.
        idle:
          type: integer
          description: Duration time while not charging in seconds.
        total:
          type: integer
          description: Total duration time in seconds.
    Location:
      type: object
      properties:
        id:
          type: integer
          example: 654321
        type:
          type: string
          enum:
            - Public road
            - Residential
            - Parking lot
            - Parking lot (indoor)
            - Parking lot (underground)
            - Hotel
        crmId:
          type: integer
        crmCustomerId:
          type: integer
          example: 123
        isEligibleForRefund:
          type: boolean
        name:
          type: string
          example: Boulevard Garibaldi
        address:
          type: string
          example: 14-16 Boulevard Garibaldi
        zipCode:
          type: string
          example: '12345'
        city:
          type: string
          example: Paris
        countryCode:
          type: string
          example: FR
          description: ISO 3166-1 alpha-2 country code
      required:
        - id
        - type
        - name
        - address
        - zipCode
        - city
    Price:
      type: object
      properties:
        amount:
          type: number
          example: 100.5
          format: float
        amountExVat:
          type: number
          example: 80.9
          format: float
        currency:
          type: string
          example: EUR
        vatRate:
          type: number
          example: 19.6
          format: float
        isDynamic:
          type: boolean
        perKwh:
          type: number
          format: float
          example: 0.5
      required:
        - amount
        - amountExVat
        - currency
        - vatRate
    RoamingDetailsHubject:
      type: object
      properties:
        role:
          type: string
          enum:
            - EMP
            - CPO
        roamingOperator:
          type: string
        roamingEvcoId:
          type: string
        roamingIdTagUid:
          type: string
        sessionStatus:
          type: string
        type:
          type: string
          example: Hubject
          default: Hubject
        sessionPayload:
          type: object
          description: >-
            This `sessionPayload` is the last received message by Hubject as a
            response from anoperation as defined by Hubject OICP 2.3 CPO and
            OICP 2.3 EMP Services & Operations documentation.The specific
            `sessionPayload` schema may vary depending on the particular
            operation response.
          externalDocs:
            description: >-
              For more detailed information refer to the OICP 2.3 CPO and OICP
              2.3 EMP Services & Operations documentation available here.
            url: https://github.com/hubject/oicp/blob/master/README.md
    RoamingDetailsOCPI:
      type: object
      properties:
        role:
          type: string
          enum:
            - EMP
            - CPO
        roamingOperator:
          type: string
        roamingEvcoId:
          type: string
        roamingIdTagUid:
          type: string
        sessionStatus:
          type: string
        type:
          type: string
          example: OCPI
          default: OCPI
        billable:
          type: boolean
    Tariff:
      type: object
      properties:
        id:
          oneOf:
            - type: integer
              format: legacy-tariffId
              description: Applied when `tariffType=legacy`. Legacy Id of a Spirii Tariff.
              deprecated: true
              example: 123456
            - type: integer
              format: voucherGroupId
              description: Applied when `tariffType=voucher`. Id of a voucherGroup applied.
              example: 654321
            - type: string
              description: >-
                Applied when `tariffType=standard`. Unique identifier for the
                Spirii tariff.
              format: uuid
              example: 79804bf6-0d6d-4e74-ae00-16c7238c4e77
            - type: string
              description: >-
                Applied when `tariffType=roaming`. The product ID of a roaming
                tariff.
              format: roaming-productId
              externalDocs:
                url: https://api.spirii.dk/roaming/hubject/pricingProductData
                description: >-
                  When this productId starts with `SPI-` it indicates a Spirii
                  roaming product ID.
              example: SPI-123
          example: 79804bf6-0d6d-4e74-ae00-16c7238c4e77
          description: Value is `null` when no tariff is applied, e.g. Free transaction.
        name:
          type: string
          description: >-
            Name of the used tariff. When `tariffType=roaming` this value is the
            same as `tariffId`.
          example: Spirii Tariff
        type:
          type: string
          enum:
            - standard
            - legacy
            - roaming
            - voucher
          example: standard
          description: Type of the tariff used.
      required:
        - id
        - name
        - type
    Voucher:
      type: object
      properties:
        id:
          type: integer
        groupId:
          type: integer
        code:
          type: string
    VoucherGroup:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
        name:
          type: string
        notes:
          type: string
        perKwh:
          type: number
          format: float
        currency:
          type: string
    IdTagDetails:
      type: object
      properties:
        id:
          type: integer
          description: >-
            Spirii ID of the authentication token (also known as charge keys or
            IdTags).
        uid:
          type: string
          description: >-
            UID of the authentication token. This is what the charger uses to
            authorise.
        type:
          type: string
          description: Spirii type of authentication token.
        label:
          type: string
          description: >-
            Label of the authentication token. This is often printed on the
            physical token.
        customerId:
          type: integer
          description: >-
            Spirii App User ID of the customer using the token. PII property -
            subject to being removed if insufficient access provided.
        operatorId:
          type: integer
          description: Spirii Operator ID to whom this token belongs.
        companyId:
          type: integer
          description: >-
            Spirii ID of the Fleet to whom this token belongs. PII property -
            subject to being removed if insufficient access provided.
        familyTreeCompanyIds:
          description: >-
            Spirii ID of the Fleet to whom this token belongs, and its parent
            companies. PII property - subject to being removed if insufficient
            access provided.
          type: array
          items:
            type: string
        crmCustomerId:
          type: integer
          description: >-
            Spirii customer ID of the associated billing customer on the token
            that was used for authentication. The customer ID can be found in
            the Connect customer management page. It corresponds with the
            customer ID that can be retrieved from the Customer API. This ID
            differs from the app user ID. PII property - subject to being
            removed if insufficient access provided.
        comment:
          type: string
          description: >-
            Additional comment on the token. PII property - subject to being
            removed if insufficient access provided.
        billingReference:
          type: string
          description: >-
            Additional billing reference on the token. PII property - subject to
            being removed if insufficient access provided.
        customerCrmCustomerId:
          type: integer
          description: >-
            Spirii CRM ID of the App User linked to the token. PII property -
            subject to being removed if insufficient access provided.
        companyCrmCustomerId:
          type: integer
          description: >-
            Spirii customer ID of the Company (billing customer) attached to the
            token. Should equal the crmCustomerId. The customer ID can be found
            in the Connect customer management page. It corresponds with the
            customer ID that can be retrieved from the Customer API. This ID
            differs from the app user ID. PII property - subject to being
            removed if insufficient access provided.
        operator:
          description: Details on the Operator (EMP) linked to the token.
          allOf:
            - $ref: '#/components/schemas/OperatorDetails'
        company:
          description: Details on the Fleet Company linked to the token.
          allOf:
            - $ref: '#/components/schemas/OptionalCompanyDetails'
        customer:
          description: Details on the App user.
          allOf:
            - $ref: '#/components/schemas/CustomerDetails'
      required:
        - uid
    OperatorDetails:
      type: object
      properties:
        id:
          type: integer
          description: >-
            Spirii ID of the operator to whom this token belongs. Same as
            operatorId on the idTag object.
        name:
          type: string
          description: Display name of the operator (EMP) to whom this token belongs.
        crmId:
          type: number
    OptionalCompanyDetails:
      type: object
      properties:
        id:
          type: integer
          description: Spirii ID of the Fleet to whom this token belongs.
        name:
          type: string
          description: >-
            Display name of the Fleet to whom this token belongs. PII property -
            subject to being removed if insufficient access provided.
    CustomerDetails:
      type: object
      properties:
        id:
          type: integer
          description: Spirii ID of the App User.
        firstName:
          type: string
          description: >-
            First Name of the App User. PII property - subject to being removed
            if insufficient access provided.
        lastName:
          type: string
          description: >-
            Last Name of the App User. PII property - subject to being removed
            if insufficient access provided.
        operator:
          description: Details on the EMP for this App User.
          allOf:
            - $ref: '#/components/schemas/EmpOperatorDetails'
        company:
          description: Details on the Fleet Company for this App User
          allOf:
            - $ref: '#/components/schemas/OptionalCompanyDetails'
        familyTreeCompanyIds:
          description: >-
            Spirii ID of the Fleet Company and its parent companies for this App
            User
          type: array
          items:
            type: string
    EmpOperatorDetails:
      type: object
      properties:
        id:
          type: integer
          description: Spirii ID of the Operator to whom this App User belongs
        name:
          type: string
          description: Display name of the Operator
  securitySchemes:
    Authorization:
      type: apiKey
      in: header
      name: Authorization
      description: '`Authorization: Bearer <SPIRII_API_KEY>`'

````