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

# Update commitment

> Updates the descriptive fields of a commitment. Economic terms are immutable.



## OpenAPI

````yaml https://swagger.flexprice.io put /commitments/{id}
openapi: 3.0.1
info:
  title: Flexprice API
  description: Flexprice API Service
  contact:
    name: API Support
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1.0'
servers:
  - url: https://us.api.flexprice.io/v1
    description: US Region
  - url: https://api.cloud.flexprice.io/v1
    description: India Region
security: []
paths:
  /commitments/{id}:
    put:
      tags:
        - Commitments
      summary: Update commitment
      description: >-
        Updates the descriptive fields of a commitment. Economic terms are
        immutable.
      operationId: updateCommitment
      parameters:
        - name: id
          in: path
          description: Commitment ID
          required: true
          schema:
            type: string
      requestBody:
        description: Commitment update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCommitmentRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommitmentResponse'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors.ErrorResponse'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: python
          label: Python
          source: |-
            from flexprice import Flexprice


            with Flexprice(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as f_client:

                res = f_client.commitments.update_commitment(id="<id>")

                # Handle response
                print(res)
        - lang: typescript
          label: TypeScript
          source: |-
            import { Flexprice } from "@flexprice/sdk";

            const flexprice = new Flexprice({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await flexprice.commitments.updateCommitment("<id>", {});

              console.log(result);
            }

            run();
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\tflexprice \"github.com/flexprice/go-sdk/v2\"\n\t\"github.com/flexprice/go-sdk/v2/models/types\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := flexprice.New(\n        flexprice.WithSecurity(\"<YOUR_API_KEY_HERE>\"),\n    )\n\n    res, err := s.Commitments.UpdateCommitment(ctx, \"<id>\", types.UpdateCommitmentRequest{})\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.CommitmentResponse != nil {\n        // handle response\n    }\n}"
components:
  schemas:
    UpdateCommitmentRequest:
      type: object
      properties:
        invoice_description:
          maxLength: 500
          type: string
        invoice_label:
          maxLength: 255
          type: string
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          maxLength: 255
          type: string
    CommitmentResponse:
      type: object
      properties:
        active_windows:
          type: array
          items:
            $ref: '#/components/schemas/types.ActiveWindow'
        binding:
          type: boolean
        collection_method:
          $ref: '#/components/schemas/types.CommitmentCollectionMethod'
        commitment_status:
          $ref: '#/components/schemas/types.CommitmentStatus'
        commitment_value:
          type: string
        committed_price_id:
          type: string
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        currency:
          type: string
        customer_id:
          type: string
        end_date:
          type: string
          format: date-time
        environment_id:
          type: string
        id:
          type: string
        idempotency_key:
          type: string
        instalment_invoicing:
          type: string
        invoice_description:
          type: string
        invoice_label:
          type: string
        measurement:
          $ref: '#/components/schemas/types.CommitmentMeasurement'
        metadata:
          $ref: '#/components/schemas/types.Metadata'
        name:
          type: string
        on_early_termination:
          $ref: '#/components/schemas/types.CommitmentEarlyTermination'
        overage_price_id:
          type: string
        priority:
          type: integer
        scope_entity_id:
          type: string
        scope_entity_type:
          $ref: '#/components/schemas/types.CommitmentScopeType'
        start_date:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/types.Status'
        subscription_id:
          type: string
        tenant_id:
          type: string
        terminated_at:
          type: string
          format: date-time
        termination_invoice_id:
          type: string
        timezone:
          type: string
        total_amount:
          type: string
        type:
          $ref: '#/components/schemas/types.CommitmentType'
        updated_at:
          type: string
          format: date-time
        updated_by:
          type: string
        value:
          type: string
    errors.ErrorResponse:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/errors.ErrorCode'
        http_status_code:
          type: integer
        message:
          type: string
      x-speakeasy-name-override: ErrorResponse
    types.Metadata:
      type: object
      additionalProperties:
        type: string
      x-speakeasy-name-override: Metadata
    types.ActiveWindow:
      type: object
      properties:
        end:
          $ref: '#/components/schemas/types.Bucket'
        start:
          $ref: '#/components/schemas/types.Bucket'
      x-speakeasy-name-override: ActiveWindow
    types.CommitmentCollectionMethod:
      type: string
      enum:
        - per_period
        - billing_terms
      x-enum-varnames:
        - CommitmentCollectionPerPeriod
        - CommitmentCollectionBillingTerms
      x-speakeasy-name-override: CommitmentCollectionMethod
    types.CommitmentStatus:
      type: string
      enum:
        - active
        - ended
        - terminated
      x-enum-varnames:
        - CommitmentStatusActive
        - CommitmentStatusEnded
        - CommitmentStatusTerminated
      x-speakeasy-name-override: CommitmentStatus
    types.CommitmentMeasurement:
      type: string
      enum:
        - billing_period
        - window
      x-enum-varnames:
        - CommitmentMeasurementBillingPeriod
        - CommitmentMeasurementWindow
      x-speakeasy-name-override: CommitmentMeasurement
    types.CommitmentEarlyTermination:
      type: string
      enum:
        - forfeit
        - credit_note
        - bill_remaining
      x-enum-varnames:
        - CommitmentTerminationForfeit
        - CommitmentTerminationCreditNote
        - CommitmentTerminationBillRemaining
      x-speakeasy-name-override: CommitmentEarlyTermination
    types.CommitmentScopeType:
      type: string
      enum:
        - subscription
        - group
        - meter
        - price
      x-enum-varnames:
        - CommitmentScopeSubscription
        - CommitmentScopeGroup
        - CommitmentScopeMeter
        - CommitmentScopePrice
      x-speakeasy-name-override: CommitmentScopeType
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    types.CommitmentType:
      type: string
      enum:
        - amount
        - quantity
      x-enum-varnames:
        - COMMITMENT_TYPE_AMOUNT
        - COMMITMENT_TYPE_QUANTITY
      x-speakeasy-name-override: CommitmentType
    errors.ErrorCode:
      type: string
      enum:
        - http_client_error
        - system_error
        - internal_error
        - not_found
        - already_exists
        - version_conflict
        - validation_error
        - invalid_operation
        - permission_denied
        - database_error
        - service_unavailable
        - too_many_requests
        - not_implemented
      x-enum-varnames:
        - ErrCodeHTTPClient
        - ErrCodeSystemError
        - ErrCodeInternalError
        - ErrCodeNotFound
        - ErrCodeAlreadyExists
        - ErrCodeVersionConflict
        - ErrCodeValidation
        - ErrCodeInvalidOperation
        - ErrCodePermissionDenied
        - ErrCodeDatabase
        - ErrCodeServiceUnavailable
        - ErrCodeTooManyRequests
        - ErrCodeNotImplemented
      x-speakeasy-name-override: ErrorCode
    types.Bucket:
      type: object
      properties:
        hour:
          maximum: 24
          minimum: 0
          type: integer
        minute:
          maximum: 59
          minimum: 0
          type: integer
      x-speakeasy-name-override: Bucket
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      description: Enter your API key in the format *x-api-key &lt;api-key&gt;**
      name: x-api-key
      in: header

````

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