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

# Change a transaction

> Sets or removes (`null`) the label and the note of a transaction of a charger you reach with
`sensitive` access or more; only the fields sent change. A transaction you see masked
(`basic` access) is a 403; one you do not see is a 404, as in `show_transaction`.



## OpenAPI

````yaml api-reference/v4/v4.openapi.json PATCH /transactions/{transaction}
openapi: 3.1.0
info:
  title: Plugchoice API
  description: >-
    Every request sends an access token as `Authorization: Bearer …`, unless an
    operation says otherwise.


    Errors are problems (RFC 9457, `application/problem+json`): `code` says what
    went wrong, and a failed validation lists the fields in `errors`.


    A list answers one page: `{"data": [...], "next_cursor": ...,
    "previous_cursor": ...}`. Pass a cursor back as `cursor` to get that page,
    and `limit` (1 to 100, default 25) for its size.


    Within v4, changes only add: new operations, new optional parameters, new
    fields and new enum values. Ignore fields you do not know, and accept enum
    values you do not know. Requests that send a field the operation does not
    know are refused, so a typo does not pass unnoticed.
  version: '4'
servers:
  - url: https://api.plugchoice.com/v4
security:
  - bearer: []
paths:
  /transactions/{transaction}:
    patch:
      tags:
        - transactions
      summary: Change a transaction
      description: >-
        Sets or removes (`null`) the label and the note of a transaction of a
        charger you reach with

        `sensitive` access or more; only the fields sent change. A transaction
        you see masked

        (`basic` access) is a 403; one you do not see is a 404, as in
        `show_transaction`.
      operationId: update_transaction
      parameters:
        - name: transaction
          in: path
          description: The transaction's id
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTransaction'
        required: true
      responses:
        '200':
          description: The transaction, changed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Transaction'
        default:
          description: >-
            A problem (RFC 9457). `code` says which; the field errors come with
            `validation_failed`.
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/Problem'
      security:
        - bearer:
            - transactions:write
components:
  schemas:
    UpdateTransaction:
      type: object
      description: 'What to change of a transaction: only the fields sent change.'
      properties:
        label:
          oneOf:
            - $ref: '#/components/schemas/TransactionLabel'
              description: >-
                Its label, or null to remove it. `business`, `private` and
                `guest` are the standard ones,

                which apps translate; anything else shows as written. Left out,
                it stays as it is.
            - type: 'null'
        note:
          oneOf:
            - $ref: '#/components/schemas/TransactionNote'
              description: Its note, or null to remove it. Left out, it stays as it is.
            - type: 'null'
      additionalProperties: false
    Transaction:
      type: object
      description: >-
        A transaction: one vehicle charged at one EVSE, from its start to its
        stop.
      required:
        - id
        - charger
        - status
        - started_at
        - time_precision
        - estimated
        - updated_at
        - card
        - charger_energy_wh
        - energy_wh
        - evse
        - label
        - location
        - meter_start_wh
        - meter_stop_wh
        - note
        - ocpp_transaction_id
        - source
        - stop_reason
        - stopped_at
        - unsettled_reason
      properties:
        card:
          oneOf:
            - $ref: '#/components/schemas/Card'
              description: >-
                The card or token that started it; null when the charger sent
                none.
            - type: 'null'
        charger:
          $ref: '#/components/schemas/ChargerReference'
        charger_energy_wh:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            The energy the charger counted, in Wh: the register it reported at
            its stop minus

            `meter_start_wh`, never below 0. It can differ from `energy_wh`,
            which is what Plugchoice

            settled: a transaction a card's operator refused, for instance,
            settles nothing. Null while

            it is active, and when the charger reported no register at its stop.
        energy_wh:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            The energy it delivered, in Wh: what Plugchoice settled,
            `meter_stop_wh` minus

            `meter_start_wh`. Null while it is active (its progress is in the
            charger's live state).
        estimated:
          type: boolean
          description: >-
            Whether `meter_stop_wh` is Plugchoice's estimate rather than a
            register the charger

            reported.
        evse:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            The number of the EVSE it charged at; null when the charger did not
            say.
        id:
          type: string
          format: uuid
          description: The transaction's id.
        label:
          type:
            - string
            - 'null'
          description: >-
            The label people gave it: `business`, `private` and `guest` are the
            standard ones, which

            apps translate; anything else shows as written. Null without one.
        location:
          oneOf:
            - $ref: '#/components/schemas/LocationReference'
              description: >-
                The location its charger is at now; null when it is at no
                location.
            - type: 'null'
        meter_start_wh:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            The EVSE's energy register when it started, in Wh; null until the
            charger sends it (an

            OCPP 2.x charger may start without it, and then the transaction
            starts at its first

            reading).
        meter_stop_wh:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            `meter_start_wh` plus the energy Plugchoice settled, in Wh; null
            while it is active. It is

            not always the register the charger reported at its stop: a
            transaction that ended without

            one is settled up to its last reading.
        note:
          type:
            - string
            - 'null'
          description: >-
            The note people wrote on it; null without one, and below `sensitive`
            access.
        ocpp_transaction_id:
          type:
            - string
            - 'null'
          description: >-
            The id the charger and Plugchoice gave it in OCPP (`transactionId`),
            as the charger's logs

            carry it: text, a number for an OCPP 1.6 charger. Null for a
            transaction imported from

            elsewhere, and below `sensitive` access.
        source:
          type:
            - string
            - 'null'
          description: >-
            Where an imported transaction came from, as whoever imported it
            named it (up to 100

            characters); null for a transaction the charger reported itself.
        started_at:
          type: string
          format: date-time
          description: When it started, by the charger's clock.
        status:
          $ref: '#/components/schemas/TransactionStatus'
        stop_reason:
          oneOf:
            - $ref: '#/components/schemas/StopReason'
              description: >-
                Why it stopped, as the charger or Plugchoice reported it; null
                while it is active, or when

                the reason is not one this API knows.
            - type: 'null'
        stopped_at:
          type:
            - string
            - 'null'
          format: date-time
          description: When it stopped; null while it is active.
        time_precision:
          $ref: '#/components/schemas/TimePrecision'
          description: >-
            How exact `started_at`, `stopped_at` and `updated_at` are: `month`
            below `sensitive`

            access for a transaction that started more than 14 days ago.
        unsettled_reason:
          oneOf:
            - $ref: '#/components/schemas/UnsettledReason'
              description: Why Plugchoice does not settle it as usual; null when it does.
            - type: 'null'
        updated_at:
          type: string
          format: date-time
          description: When it, its label or its note last changed.
    Problem:
      type: object
      description: An error response body (RFC 9457).
      required:
        - type
        - title
        - status
        - code
      properties:
        code:
          type: string
          description: >-
            The kind of problem, for code to act on, such as
            `validation_failed`. Treat a code you do

            not know by the status.
        detail:
          type: string
          description: >-
            What went wrong with this request, when there is more to say than
            the title; left out

            when there is not.
        errors:
          type: array
          items:
            $ref: '#/components/schemas/FieldError'
          description: >-
            With `validation_failed`: the fields that broke a rule; left out
            when there are none.
        status:
          type: integer
          format: int32
          description: The HTTP status code.
          minimum: 0
        title:
          type: string
          description: A short summary of the kind of problem.
        type:
          type: string
          description: >-
            The page that explains this kind of problem: its `code` with
            hyphens, as

            `https://developer.plugchoice.com/api/errors/validation-failed`.
    TransactionLabel:
      type: string
      description: >-
        A transaction's label: 1 to 50 characters, with spaces around it
        removed.
      maxLength: 50
      minLength: 1
    TransactionNote:
      type: string
      description: >-
        A transaction's note: 1 to 1000 characters, with spaces around it
        removed.
      maxLength: 1000
      minLength: 1
    Card:
      type: object
      description: The card or token that started a transaction.
      required:
        - id_tag
        - name
        - status
      properties:
        id_tag:
          type: string
          description: >-
            The id the charger sent (OCPP's idTag or idToken). Below `sensitive`
            access it shows its

            last three characters: `••••34A`.
        name:
          type:
            - string
            - 'null'
          description: >-
            The name of the card with this id at the charger's location; null
            when the location has

            none. Below `sensitive` access it shows its first and last two
            letters: `Ja****en`.
        status:
          oneOf:
            - $ref: '#/components/schemas/CardStatus'
              description: >-
                What the card check answered when the transaction started; null
                when it is not known.
            - type: 'null'
    ChargerReference:
      type: object
      description: A charger, as a transaction names it.
      required:
        - id
        - identity
      properties:
        id:
          type: string
          format: uuid
          description: The charger's id.
        identity:
          type: string
          description: 'The name it connects with: its OCPP charge point identity.'
    LocationReference:
      type: object
      description: A location, as a charger names it.
      required:
        - id
        - name
      properties:
        id:
          type: string
          format: uuid
          description: The location's id.
        name:
          type:
            - string
            - 'null'
          description: Its name; null when it has none.
    TransactionStatus:
      type: string
      description: >-
        Where a transaction is, from its start until Plugchoice settled it. One
        from before 26 October

        2026, when Plugchoice started recording this, is `final`, or
        `incomplete` when Plugchoice

        recorded closing it without a stop from the charger. Accept values you
        do not know: more may

        come.
      enum:
        - active
        - stopped
        - final
        - incomplete
    StopReason:
      type: string
      description: >-
        Why a transaction stopped: OCPP's reasons (1.6 and 2.x), and
        `auto_closed`. Accept values

        you do not know: more may come.
      enum:
        - de_authorized
        - emergency_stop
        - energy_limit_reached
        - ev_disconnected
        - ground_fault
        - hard_reset
        - immediate_reset
        - local
        - local_out_of_credit
        - master_pass
        - other
        - overcurrent_fault
        - power_loss
        - power_quality
        - reboot
        - remote
        - soc_limit_reached
        - soft_reset
        - stopped_by_ev
        - time_limit_reached
        - timeout
        - unlock_command
        - auto_closed
    TimePrecision:
      type: string
      description: >-
        How exact a resource's times are. Accept values you do not know: more
        may come.
      enum:
        - exact
        - month
    UnsettledReason:
      type: string
      description: >-
        Why a transaction is not settled as usual. Accept values you do not
        know: more may come.
      enum:
        - operator_refused_local_override
    FieldError:
      type: object
      description: One field that broke a rule.
      required:
        - field
        - code
        - message
      properties:
        code:
          type: string
          description: >-
            The rule it broke, for code to act on: `missing_field`,
            `unknown_field`, `invalid_type`,

            `invalid`, or `taken` (a value that must be unique, such as a card's
            id at a location,

            and is not).
        field:
          type: string
          description: >-
            Where the field is in the request, such as `name` or
            `connectors[0].max_current`.
        message:
          type: string
          description: What is wrong, in English.
    CardStatus:
      type: string
      description: >-
        What a card check answered, as OCPP names it (1.6's
        `AuthorizationStatus` and 2.x's

        `AuthorizationStatusEnumType`). Accept values you do not know: more may
        come.
      enum:
        - accepted
        - blocked
        - expired
        - invalid
        - concurrent_tx
        - no_credit
        - not_allowed_type_evse
        - not_at_this_location
        - not_at_this_time
        - unknown
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        An access token from `accounts.plugchoice.com`, for a personal API
        token, a person signed in through an app, or an OAuth client.

````

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