Add Currencies

Purpose

To add new currencies to your organization.

Endpoints

  • POST /org/currencies

Request Details

Request URL

{api-domain}/crm/{version}/org/currencies

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

ZohoCRM.settings.currencies.{operation_type}

Possible operation types

CREATE - Create currencies
ALL - Full access to currencies' data

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v8/org/currencies"
-X POST
-d input.json
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedcurrency1Format = Map();
currency1Format.put("decimal_separator", "Period");
currency1Format.put("thousand_separator", "Comma");
currency1Format.put("decimal_places", "2");

currency1 = Map();
currency1.put("format", currency1Format);
currency1.put("prefix_symbol", true);
currency1.put("name", "Algerian Dinar-ADN");
currency1.put("iso_code", "DZD");
currency1.put("symbol", "Af");
currency1.put("exchange_rate", "1.0000000");
currency1.put("is_active", "true");

currenciesList = List();
currenciesList.add(currency1);

params = Map();
params.put("currencies", currenciesList);


response = invokeurl
[
	url :"https://www.zohoapis.com/crm/v8/org/currencies"
	type :POST
	parameters: params.toString()
	connection:"crm_oauth_connection"
];
info response;

In the request, "@input.json" contains the sample input data.

Request JSON Keys

  • namestring, mandatory

    Represents the name of the currency. You can get the available currencies from the CRM UI at Setup > General > Company Settings > Currencies.

  • iso_codestring, mandatory

    Represents the ISO code of the currency. You can get the currency code from the CRM UI at Setup > General > Company Settings > Currencies.

  • exchange_ratestring, mandatory

    Represents the rate at which the currency has to be exchanged with home currency. Accepts positive decimal numbers up to nine digits and nine decimal places. Example: 123456789.123456789.

  • prefix_symbolBoolean, optional

    Represents the position of the ISO code in the currency.

    Possible Values:

    • true - Display ISO code before the currency value. This is the default value.
    • false - Display ISO code after the currency value.
  • symbolstring, optional

    Represents the symbol of the currency.

  • is_activeBoolean, optional

    Represents the status of the currency.
    Possible Values:

    • true - The currency is active. This is the default value.
    • false - The currency is inactive.
  • formatJSON object, optional

    Represents the format of the base currency with details like decimal_separator, thousand_separator, and decimal_places.

Keys in the "format" JSON Object

  • decimal_separatorstring, optional

    The decimal separator separates the integer part of the currency from its fractional part. It can be a Period or Comma, depending on the currency.

  • thousand_separatorstring, optional

    The thousand separator separates groups of thousands in a currency. It can be a Period, Comma, or Space, depending on the currency.

  • decimal_placesinteger, optional

    Represents the number of decimal places allowed for the currency. It can be 0, 2, and 3.

Sample Input

Copied{
  "currencies": [
    {
      "format": {
        "decimal_separator": "Period",
        "thousand_separator": "Comma",
        "decimal_places": "2"
      },
      "prefix_symbol": true,
      "name": "Saudi Riyal - SAR",
      "iso_code": "SAR",
      "symbol": "SR",
      "exchange_rate": "1.0000000",
      "is_active": true
    }
  ]
}

Possible Errors

  • ACTIVE_STATE_LIMIT_EXCEEDEDHTTP 400

    You have reached the allowed active currency limit of 10 reached. 
    Resolution: Deactivate any one of the existing active currencies to create this currency.

  • INVALID_DATAHTTP 400

    You have specified either an invalid currency name or ISO code.
    Resolution: Go to Setup > General > Company Details> Currencies > Click Add. The Currency picklist will have valid currency names and ISO codes.

  • INVALID_DATAHTTP 400

    You have specified an invalid currency symbol.
    Resolution: Input a valid symbol for the currency.

  • DUPLICATE_DATAHTTP 400

    You have given a duplicate value for the ISO code.
    Resolution: The currency specified in the input JSON is already present. Even if the status of the currency is inactive, it will still be present in the list.

  • MANDATORY_NOT_FOUNDHTTP 400

    You have not specified one or more mandatory fields in the input.
    Resolution: Refer to the Request JSON for all the mandatory keys in the input.

  • INVALID_REQUEST_METHODHTTP 400

    The request method is incorrect.
    Resolution: Use the HTTP POST method to make this API call. Any other request method will result in this error.

  • AUTHORIZATION_FAILEDHTTP 400

    You do not have sufficient permission to add currencies.
    Resolution: Contact your system administrator.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    The access token you have used to make this API call does not have the required scope.
    Resolution: Generate a new access token with the scopes mentioned in the Scope section.

  • NO_PERMISSIONHTTP 403

    You do not have permission to add currencies.
    Resolution: Contact your system administrator.

  • FEATURE_NOT_SUPPORTEDHTTP 403

    The multi-currency feature is not available except in the Enterprise and higher editions.
    Resolution: Upgrade your edition or contact your system administrator.

  • INVALID_URL_PATTERNHTTP 404

    The request URL is incorrect.
    Resolution: Specify a valid request URL. Refer to the Request URL section for the right URL.

  • INTERNAL_ERRORHTTP 500

    Unexpected and unhandled exception in the server. 
    Resolution: Contact the support team at support@zohocrm.com.

Sample Response

Copied{
    "currencies": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "4150868000000780026"
            },
            "message": "The currency created successfully.",
            "status": "success"
        }
    ]
}