> 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.

# Create Currency

POST http://localhost:9000/api/v1/currency_admin
Content-Type: application/json

Creates a currency. Requires role `4`.

Required body fields: `code`, `symbol`, `exchangeRates[].code`, `exchangeRates[].value`. Optional: `base`, `active`, `paymentDescription`, `taxTitle`, `taxPercentage`, `onlinePaymentMethod`, `paymentMethods[]`. Valid payment method names: `paystack`, `Paypal`, `authorize.net`.

Response fields: created 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/create-currency

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/currency_admin:
    post:
      operationId: create-currency
      summary: Create Currency
      description: >-
        Creates a currency. Requires role `4`.


        Required body fields: `code`, `symbol`, `exchangeRates[].code`,
        `exchangeRates[].value`. Optional: `base`, `active`,
        `paymentDescription`, `taxTitle`, `taxPercentage`,
        `onlinePaymentMethod`, `paymentMethods[]`. Valid payment method names:
        `paystack`, `Paypal`, `authorize.net`.


        Response fields: created 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
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/currency_admin_Create
                  Currency_Response_201
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1Currency_adminRequestBadRequestError
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1Currency_adminRequestUnauthorizedError
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1Currency_adminRequestForbiddenError
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1Currency_adminRequestNotFoundError
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1Currency_adminRequestTooManyRequestsError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/PostApiV1Currency_adminRequestInternalServerError
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                base:
                  type: boolean
                code:
                  type: string
                active:
                  type: boolean
                symbol:
                  type: string
                taxTitle:
                  type: string
                exchangeRates:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/ApiV1CurrencyAdminPostRequestBodyContentApplicationJsonSchemaExchangeRatesItems
                taxPercentage:
                  type: integer
                paymentMethods:
                  type: array
                  items:
                    $ref: >-
                      #/components/schemas/ApiV1CurrencyAdminPostRequestBodyContentApplicationJsonSchemaPaymentMethodsItems
                paymentDescription:
                  type: string
                onlinePaymentMethod:
                  type: string
              required:
                - base
                - code
                - active
                - symbol
                - taxTitle
                - exchangeRates
                - taxPercentage
                - paymentMethods
                - paymentDescription
                - onlinePaymentMethod
servers:
  - url: http://localhost:9000
    description: http://localhost:9000
components:
  schemas:
    ApiV1CurrencyAdminPostRequestBodyContentApplicationJsonSchemaExchangeRatesItems:
      type: object
      properties:
        code:
          type: string
        value:
          type: integer
      required:
        - code
        - value
      title: >-
        ApiV1CurrencyAdminPostRequestBodyContentApplicationJsonSchemaExchangeRatesItems
    ApiV1CurrencyAdminPostRequestBodyContentApplicationJsonSchemaPaymentMethodsItems:
      type: object
      properties:
        name:
          type: string
        active:
          type: boolean
      required:
        - name
        - active
      title: >-
        ApiV1CurrencyAdminPostRequestBodyContentApplicationJsonSchemaPaymentMethodsItems
    currency_admin_Create Currency_Response_201:
      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_Create Currency_Response_201
    PostApiV1Currency_adminRequestBadRequestError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostApiV1Currency_adminRequestBadRequestError
    PostApiV1Currency_adminRequestUnauthorizedError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostApiV1Currency_adminRequestUnauthorizedError
    PostApiV1Currency_adminRequestForbiddenError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostApiV1Currency_adminRequestForbiddenError
    PostApiV1Currency_adminRequestNotFoundError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostApiV1Currency_adminRequestNotFoundError
    PostApiV1Currency_adminRequestTooManyRequestsError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostApiV1Currency_adminRequestTooManyRequestsError
    PostApiV1Currency_adminRequestInternalServerError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: PostApiV1Currency_adminRequestInternalServerError

```

## Examples



**Request**

```json
{
  "base": false,
  "code": "USD",
  "active": true,
  "symbol": "$",
  "taxTitle": "VAT",
  "exchangeRates": [
    {
      "code": "NGN",
      "value": 460
    },
    {
      "code": "GBP",
      "value": 0
    }
  ],
  "taxPercentage": 7,
  "paymentMethods": [
    {
      "name": "Paypal",
      "active": true
    },
    {
      "name": "authorize.net",
      "active": true
    }
  ],
  "paymentDescription": "Pay securely in USD using trusted gateways",
  "onlinePaymentMethod": "Paypal"
}
```

**Response**

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

**SDK Code**

```python currency_admin_Create Currency_example
import requests

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

payload = {
    "base": False,
    "code": "USD",
    "active": True,
    "symbol": "$",
    "taxTitle": "VAT",
    "exchangeRates": [
        {
            "code": "NGN",
            "value": 460
        },
        {
            "code": "GBP",
            "value": 0
        }
    ],
    "taxPercentage": 7,
    "paymentMethods": [
        {
            "name": "Paypal",
            "active": True
        },
        {
            "name": "authorize.net",
            "active": True
        }
    ],
    "paymentDescription": "Pay securely in USD using trusted gateways",
    "onlinePaymentMethod": "Paypal"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript currency_admin_Create Currency_example
const url = 'http://localhost:9000/api/v1/currency_admin';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"base":false,"code":"USD","active":true,"symbol":"$","taxTitle":"VAT","exchangeRates":[{"code":"NGN","value":460},{"code":"GBP","value":0}],"taxPercentage":7,"paymentMethods":[{"name":"Paypal","active":true},{"name":"authorize.net","active":true}],"paymentDescription":"Pay securely in USD using trusted gateways","onlinePaymentMethod":"Paypal"}'
};

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

```go currency_admin_Create Currency_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"base\": false,\n  \"code\": \"USD\",\n  \"active\": true,\n  \"symbol\": \"$\",\n  \"taxTitle\": \"VAT\",\n  \"exchangeRates\": [\n    {\n      \"code\": \"NGN\",\n      \"value\": 460\n    },\n    {\n      \"code\": \"GBP\",\n      \"value\": 0\n    }\n  ],\n  \"taxPercentage\": 7,\n  \"paymentMethods\": [\n    {\n      \"name\": \"Paypal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"authorize.net\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Pay securely in USD using trusted gateways\",\n  \"onlinePaymentMethod\": \"Paypal\"\n}")

	req, _ := http.NewRequest("POST", 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_Create Currency_example
require 'uri'
require 'net/http'

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

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"base\": false,\n  \"code\": \"USD\",\n  \"active\": true,\n  \"symbol\": \"$\",\n  \"taxTitle\": \"VAT\",\n  \"exchangeRates\": [\n    {\n      \"code\": \"NGN\",\n      \"value\": 460\n    },\n    {\n      \"code\": \"GBP\",\n      \"value\": 0\n    }\n  ],\n  \"taxPercentage\": 7,\n  \"paymentMethods\": [\n    {\n      \"name\": \"Paypal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"authorize.net\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Pay securely in USD using trusted gateways\",\n  \"onlinePaymentMethod\": \"Paypal\"\n}"

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

```java currency_admin_Create Currency_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("http://localhost:9000/api/v1/currency_admin")
  .header("Content-Type", "application/json")
  .body("{\n  \"base\": false,\n  \"code\": \"USD\",\n  \"active\": true,\n  \"symbol\": \"$\",\n  \"taxTitle\": \"VAT\",\n  \"exchangeRates\": [\n    {\n      \"code\": \"NGN\",\n      \"value\": 460\n    },\n    {\n      \"code\": \"GBP\",\n      \"value\": 0\n    }\n  ],\n  \"taxPercentage\": 7,\n  \"paymentMethods\": [\n    {\n      \"name\": \"Paypal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"authorize.net\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Pay securely in USD using trusted gateways\",\n  \"onlinePaymentMethod\": \"Paypal\"\n}")
  .asString();
```

```php currency_admin_Create Currency_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'http://localhost:9000/api/v1/currency_admin', [
  'body' => '{
  "base": false,
  "code": "USD",
  "active": true,
  "symbol": "$",
  "taxTitle": "VAT",
  "exchangeRates": [
    {
      "code": "NGN",
      "value": 460
    },
    {
      "code": "GBP",
      "value": 0
    }
  ],
  "taxPercentage": 7,
  "paymentMethods": [
    {
      "name": "Paypal",
      "active": true
    },
    {
      "name": "authorize.net",
      "active": true
    }
  ],
  "paymentDescription": "Pay securely in USD using trusted gateways",
  "onlinePaymentMethod": "Paypal"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp currency_admin_Create Currency_example
using RestSharp;

var client = new RestClient("http://localhost:9000/api/v1/currency_admin");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"base\": false,\n  \"code\": \"USD\",\n  \"active\": true,\n  \"symbol\": \"$\",\n  \"taxTitle\": \"VAT\",\n  \"exchangeRates\": [\n    {\n      \"code\": \"NGN\",\n      \"value\": 460\n    },\n    {\n      \"code\": \"GBP\",\n      \"value\": 0\n    }\n  ],\n  \"taxPercentage\": 7,\n  \"paymentMethods\": [\n    {\n      \"name\": \"Paypal\",\n      \"active\": true\n    },\n    {\n      \"name\": \"authorize.net\",\n      \"active\": true\n    }\n  ],\n  \"paymentDescription\": \"Pay securely in USD using trusted gateways\",\n  \"onlinePaymentMethod\": \"Paypal\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift currency_admin_Create Currency_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "base": false,
  "code": "USD",
  "active": true,
  "symbol": "$",
  "taxTitle": "VAT",
  "exchangeRates": [
    [
      "code": "NGN",
      "value": 460
    ],
    [
      "code": "GBP",
      "value": 0
    ]
  ],
  "taxPercentage": 7,
  "paymentMethods": [
    [
      "name": "Paypal",
      "active": true
    ],
    [
      "name": "authorize.net",
      "active": true
    ]
  ],
  "paymentDescription": "Pay securely in USD using trusted gateways",
  "onlinePaymentMethod": "Paypal"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:9000/api/v1/currency_admin")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```