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

# Update Subscription

> Update an existing subscription. Always read `ts` from the GET response before updating — the backend rejects stale updates. `serviceCode` cannot be changed. Subscriptions with `status: "Disconnected"` cannot be updated.



## OpenAPI

````yaml POST /billspree/connections/update-connection
openapi: 3.1.0
info:
  title: Billspree API
  description: REST API for Billspree — billing, AR management, and workspace operations.
  version: 1.0.0
servers:
  - url: https://{workspace}.spreesuite.com
    variables:
      workspace:
        default: your-workspace
        description: Your organization's subdomain (e.g. demo → demo.spreesuite.com)
security:
  - apiKeyAuth: []
paths:
  /billspree/connections/update-connection:
    post:
      tags:
        - Subscriptions
      summary: Update Subscription
      description: >-
        Update an existing subscription. Always read `ts` from the GET response
        before updating — the backend rejects stale updates. `serviceCode`
        cannot be changed. Subscriptions with `status: "Disconnected"` cannot be
        updated.
      operationId: updateConnection
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateConnectionRequest'
            example:
              method: Update
              action: Update Subscription
              apiVersion: v2
              connection:
                id: 1
                connectionNumber: CONN-001
                tariffCode: DemoPlan
                batchCode: null
                connRefNo: null
                description: null
                ts: 1
                connectionDate: '01012026'
                paymentMethod: null
                connectionInputs:
                  - name: MeterNo
                    value: '99999'
                meteredConnectionInputs: []
                address:
                  city: Karachi
                  street: Main Blvd
                  countryId: null
                users: []
                meters: []
                accounts: []
                variants: []
      responses:
        '200':
          description: Subscription updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericSuccessResponse'
              example:
                success: true
                statusCode: 200
                message: Request Succeeded.
                error: null
                data: {}
components:
  schemas:
    UpdateConnectionRequest:
      type: object
      required:
        - method
        - action
        - apiVersion
        - connection
      properties:
        method:
          type: string
          description: Always `"Update"`
          example: Update
        action:
          type: string
          description: Always `"Update Subscription"`
          example: Update Subscription
        apiVersion:
          type: string
          description: Always `"v2"`
          example: v2
        connection:
          $ref: '#/components/schemas/UpdateConnectionPayload'
    GenericSuccessResponse:
      type: object
      properties:
        success:
          type: boolean
        statusCode:
          type: integer
        message:
          type: string
        error:
          nullable: true
        data:
          type: object
    UpdateConnectionPayload:
      type: object
      required:
        - id
        - connectionNumber
        - ts
        - connectionInputs
        - meteredConnectionInputs
      properties:
        id:
          type: integer
          description: Internal subscription ID — required to identify the record
        connectionNumber:
          type: string
          description: Subscription identifier — required on update
        tariffCode:
          type: string
          description: Can be changed to switch the plan
        batchCode:
          type: string
          nullable: true
        connRefNo:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        ts:
          type: integer
          description: >-
            Version timestamp from the GET response — backend rejects stale
            updates if this doesn't match
        connectionDate:
          type: string
          description: Start date in `ddmmyyyy` format — send as-is from GET
        paymentMethod:
          type: string
          nullable: true
        connectionInputs:
          type: array
          description: Updated custom field values
          items:
            $ref: '#/components/schemas/ConnectionInput'
        meteredConnectionInputs:
          type: array
          items: {}
        address:
          $ref: '#/components/schemas/ConnectionAddress'
        users:
          type: array
          items: {}
        meters:
          type: array
          items: {}
        accounts:
          type: array
          items: {}
        variants:
          type: array
          items: {}
    ConnectionInput:
      type: object
      properties:
        name:
          type: string
          description: Field name as defined on the pricing template
        value:
          type: string
          description: Value for this field
    ConnectionAddress:
      type: object
      properties:
        title:
          type: string
          nullable: true
        shopNo:
          type: string
          nullable: true
        buildingNo:
          type: string
          nullable: true
        buildingName:
          type: string
          nullable: true
        street:
          type: string
          nullable: true
        block:
          type: string
          nullable: true
        society:
          type: string
          nullable: true
        city:
          type: string
          nullable: true
        countryId:
          type: integer
          nullable: true
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Auth token returned from the login endpoint. Send as: `Authorization:
        <token>` (no Bearer prefix)

````