> ## 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 an FX rate

> Update a rate's value, validity window (overrides only) or metadata. Scope, scope_id and the currency pair are immutable.



## OpenAPI

````yaml https://spec.speakeasy.com/flexprice/prod/swagger-json-with-code-samples put /forex/{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:
  /forex/{id}:
    put:
      tags:
        - FX Rates
      summary: Update an FX rate
      description: >-
        Update a rate's value, validity window (overrides only) or metadata.
        Scope, scope_id and the currency pair are immutable.
      operationId: updateFXRate
      parameters:
        - name: id
          in: path
          description: FX rate ID
          required: true
          schema:
            type: string
      requestBody:
        description: FX rate fields to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFXRateRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FXRateResponse'
        '400':
          description: Invalid request
          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: 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.fxRates.updateFXRate("<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.FXRates.UpdateFXRate(ctx, \"<id>\", types.UpdateFXRateRequest{})\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.FXRateResponse != nil {\n        // handle response\n    }\n}"
        - lang: python
          label: Python
          source: |-
            from flexprice import Flexprice


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

                res = f_client.fx_rates.update_fx_rate(id="<id>")

                # Handle response
                print(res)
components:
  schemas:
    UpdateFXRateRequest:
      type: object
      properties:
        end_date:
          type: string
          format: date-time
        metadata:
          type: object
          additionalProperties:
            type: string
        rate:
          type: string
        start_date:
          type: string
          format: date-time
    FXRateResponse:
      type: object
      properties:
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
        end_date:
          type: string
          format: date-time
        environment_id:
          type: string
        from_currency:
          type: string
        id:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        rate:
          type: string
        scope:
          $ref: '#/components/schemas/types.FXRateScope'
        scope_id:
          type: string
        source:
          $ref: '#/components/schemas/types.FXRateSource'
        start_date:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/types.Status'
        tenant_id:
          type: string
        to_currency:
          type: string
        updated_at:
          type: string
          format: date-time
        updated_by:
          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.FXRateScope:
      type: string
      enum:
        - tenant
        - customer
        - subscription
      x-enum-varnames:
        - FXRateScopeTenant
        - FXRateScopeCustomer
        - FXRateScopeSubscription
      x-speakeasy-name-override: FXRateScope
    types.FXRateSource:
      type: string
      enum:
        - fixed
        - market
      x-enum-varnames:
        - FXRateSourceFixed
        - FXRateSourceMarket
      x-speakeasy-name-override: FXRateSource
    types.Status:
      type: string
      enum:
        - published
        - deleted
        - archived
      x-enum-varnames:
        - StatusPublished
        - StatusDeleted
        - StatusArchived
      x-speakeasy-name-override: Status
    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
  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.