> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mycargoextra.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mycargoextra.com/_mcp/server.

# Update Currency

PATCH http://localhost:9000/api/v1/currency_admin/{currencyId}
Content-Type: application/json

Updates allowed currency fields. Requires role `4`.

Allowed body fields: `exchangeRates`, `active`, `paymentDescription`, `onlinePaymentMethod`, `paymentMethods`, `taxTitle`, `taxPercentage`.

Response fields: updated currency document.

Possible errors:
- 401: Unauthorized - authenticated admin is not role `4`.
- 400: Only one currency can be base - another base currency exists.
- 400: Invalid Update - unsupported field or invalid currency id.
- 404: Not Found - currency id does not exist.
- 400: Can't disable base - base currency cannot be disabled.
- 400: Currency requires an active payment method - active currency has no active payment method.
- 400: Payment method is disabled - configured method is not allowed for currency.
- 400: Missing One or More Required Parameters - required body/query fields were not supplied.
- 401: Unauthorized - token is missing, expired, invalid, or the account/token pair was not found.
- 403: Access denied - gateway traffic guard/rate policy blocked the request.
- 429: Too many requests - gateway rate limit exceeded.
- 500: Unexpected Error - unhandled gateway or downstream service failure.

Reference: https://docs.mycargoextra.com/cargo-extra-gateway-api-copy/currency-admin/currency-id/update-currency

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/currency_admin/{currencyId}:
    patch:
      operationId: update-currency
      summary: Update Currency
      description: >-
        Updates allowed currency fields. Requires role `4`.


        Allowed body fields: `exchangeRates`, `active`, `paymentDescription`,
        `onlinePaymentMethod`, `paymentMethods`, `taxTitle`, `taxPercentage`.


        Response fields: updated currency document.


        Possible errors:

        - 401: Unauthorized - authenticated admin is not role `4`.

        - 400: Only one currency can be base - another base currency exists.

        - 400: Invalid Update - unsupported field or invalid currency id.

        - 404: Not Found - currency id does not exist.

        - 400: Can't disable base - base currency cannot be disabled.

        - 400: Currency requires an active payment method - active currency has
        no active payment method.

        - 400: Payment method is disabled - configured method is not allowed for
        currency.

        - 400: Missing One or More Required Parameters - required body/query
        fields were not supplied.

        - 401: Unauthorized - token is missing, expired, invalid, or the
        account/token pair was not found.

        - 403: Access denied - gateway traffic guard/rate policy blocked the
        request.

        - 429: Too many requests - gateway rate limit exceeded.

        - 500: Unexpected Error - unhandled gateway or downstream service
        failure.
      tags:
        - subpackage_currencyAdmin.subpackage_currencyAdmin/currencyId
      parameters:
        - name: currencyId
          in: path
          description: CurrencyId path parameter.
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/currency_admin_{currencyId}_Update
                  Currency_Response_200
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiV1Currency_adminCurrencyidRequestBadRequestError
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiV1Currency_adminCurrencyidRequestUnauthorizedError
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiV1Currency_adminCurrencyidRequestForbiddenError
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiV1Currency_adminCurrencyidRequestNotFoundError
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiV1Currency_adminCurrencyidRequestTooManyRequestsError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PatchApiV1Currency_adminCurrencyidRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                active:
                  type: boolean
                exchangeRates:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/ApiV1CurrencyAdminCurrencyIdPatchRequestBodyContentApplicationJsonSchemaExchangeRatesItems
                paymentMethods:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/ApiV1CurrencyAdminCurrencyIdPatchRequestBodyContentApplicationJsonSchemaPaymentMethodsItems
                paymentDescription:
                  type: string
              required:
                - active
                - exchangeRates
                - paymentMethods
                - paymentDescription
servers:
  - url: http://localhost:9000
    description: http://localhost:9000
components:
  schemas:
    ApiV1CurrencyAdminCurrencyIdPatchRequestBodyContentApplicationJsonSchemaExchangeRatesItems:
      type: object
      properties:
        code:
          type: string
        value:
          type: integer
      required:
        - code
        - value
      title: >-
        ApiV1CurrencyAdminCurrencyIdPatchRequestBodyContentApplicationJsonSchemaExchangeRatesItems
    ApiV1CurrencyAdminCurrencyIdPatchRequestBodyContentApplicationJsonSchemaPaymentMethodsItems:
      type: object
      properties:
        name:
          type: string
        active:
          type: boolean
      required:
        - name
        - active
      title: >-
        ApiV1CurrencyAdminCurrencyIdPatchRequestBodyContentApplicationJsonSchemaPaymentMethodsItems
    currency_admin_{currencyId}_Update Currency_Response_200:
      type: object
      properties:
        key_0:
          type: integer
        key_1:
          type: string
        key_2:
          type: number
          format: double
        key_3:
          type: string
        key_4:
          type: boolean
      required:
        - key_0
        - key_1
        - key_2
        - key_3
        - key_4
      title: currency_admin_{currencyId}_Update Currency_Response_200
    PatchApiV1Currency_adminCurrencyidRequestBadRequestError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PatchApiV1Currency_adminCurrencyidRequestBadRequestError
    PatchApiV1Currency_adminCurrencyidRequestUnauthorizedError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PatchApiV1Currency_adminCurrencyidRequestUnauthorizedError
    PatchApiV1Currency_adminCurrencyidRequestForbiddenError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PatchApiV1Currency_adminCurrencyidRequestForbiddenError
    PatchApiV1Currency_adminCurrencyidRequestNotFoundError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PatchApiV1Currency_adminCurrencyidRequestNotFoundError
    PatchApiV1Currency_adminCurrencyidRequestTooManyRequestsError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PatchApiV1Currency_adminCurrencyidRequestTooManyRequestsError
    PatchApiV1Currency_adminCurrencyidRequestInternalServerError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PatchApiV1Currency_adminCurrencyidRequestInternalServerError

```

## Examples



**Request**

```json
{
  "active": true,
  "exchangeRates": [
    {
      "code": "USD",
      "value": 1
    },
    {
      "code": "EUR",
      "value": 0
    }
  ],
  "paymentMethods": [
    {
      "name": "PayPal",
      "active": true
    },
    {
      "name": "Stripe",
      "active": true
    }
  ],
  "paymentDescription": "Please use one of the active payment methods to complete your transaction."
}
```

**Response**

```json
{
  "key_0": 1001,
  "key_1": "USD",
  "key_2": 1,
  "key_3": "United States Dollar",
  "key_4": true
}
```

**SDK Code**

```python currency_admin_{currencyId}_Update Currency_example
import requests

url = "http://localhost:9000/api/v1/currency_admin/string"

payload = {
    "active": True,
    "exchangeRates": [
        {
            "code": "USD",
            "value": 1
        },
        {
            "code": "EUR",
            "value": 0
        }
    ],
    "paymentMethods": [
        {
            "name": "PayPal",
            "active": True
        },
        {
            "name": "Stripe",
            "active": True
        }
    ],
    "paymentDescription": "Please use one of the active payment methods to complete your transaction."
}
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript currency_admin_{currencyId}_Update Currency_example
const url = 'http://localhost:9000/api/v1/currency_admin/string';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json'},
  body: '{"active":true,"exchangeRates":[{"code":"USD","value":1},{"code":"EUR","value":0}],"paymentMethods":[{"name":"PayPal","active":true},{"name":"Stripe","active":true}],"paymentDescription":"Please use one of the active payment methods to complete your transaction."}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go currency_admin_{currencyId}_Update Currency_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:9000/api/v1/currency_admin/string"

	payload := strings.NewReader("{\n  \"active\": true,\n  \"exchangeRates\": [\n    {\n      \"code\": \"USD\",\n      \"value\": 1\n    },\n    {\n      \"code\": \"EUR\",\n      \"value\": 0\n    }\n  ],\n  \"paymentMethods\": [\n    {\n      \"name\": \"PayPal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"Stripe\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Please use one of the active payment methods to complete your transaction.\"\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby currency_admin_{currencyId}_Update Currency_example
require 'uri'
require 'net/http'

url = URI("http://localhost:9000/api/v1/currency_admin/string")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"active\": true,\n  \"exchangeRates\": [\n    {\n      \"code\": \"USD\",\n      \"value\": 1\n    },\n    {\n      \"code\": \"EUR\",\n      \"value\": 0\n    }\n  ],\n  \"paymentMethods\": [\n    {\n      \"name\": \"PayPal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"Stripe\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Please use one of the active payment methods to complete your transaction.\"\n}"

response = http.request(request)
puts response.read_body
```

```java currency_admin_{currencyId}_Update Currency_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.patch("http://localhost:9000/api/v1/currency_admin/string")
  .header("Content-Type", "application/json")
  .body("{\n  \"active\": true,\n  \"exchangeRates\": [\n    {\n      \"code\": \"USD\",\n      \"value\": 1\n    },\n    {\n      \"code\": \"EUR\",\n      \"value\": 0\n    }\n  ],\n  \"paymentMethods\": [\n    {\n      \"name\": \"PayPal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"Stripe\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Please use one of the active payment methods to complete your transaction.\"\n}")
  .asString();
```

```php currency_admin_{currencyId}_Update Currency_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'http://localhost:9000/api/v1/currency_admin/string', [
  'body' => '{
  "active": true,
  "exchangeRates": [
    {
      "code": "USD",
      "value": 1
    },
    {
      "code": "EUR",
      "value": 0
    }
  ],
  "paymentMethods": [
    {
      "name": "PayPal",
      "active": true
    },
    {
      "name": "Stripe",
      "active": true
    }
  ],
  "paymentDescription": "Please use one of the active payment methods to complete your transaction."
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp currency_admin_{currencyId}_Update Currency_example
using RestSharp;

var client = new RestClient("http://localhost:9000/api/v1/currency_admin/string");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"active\": true,\n  \"exchangeRates\": [\n    {\n      \"code\": \"USD\",\n      \"value\": 1\n    },\n    {\n      \"code\": \"EUR\",\n      \"value\": 0\n    }\n  ],\n  \"paymentMethods\": [\n    {\n      \"name\": \"PayPal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"Stripe\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Please use one of the active payment methods to complete your transaction.\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift currency_admin_{currencyId}_Update Currency_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "active": true,
  "exchangeRates": [
    [
      "code": "USD",
      "value": 1
    ],
    [
      "code": "EUR",
      "value": 0
    ]
  ],
  "paymentMethods": [
    [
      "name": "PayPal",
      "active": true
    ],
    [
      "name": "Stripe",
      "active": true
    ]
  ],
  "paymentDescription": "Please use one of the active payment methods to complete your transaction."
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:9000/api/v1/currency_admin/string")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```