Skip to main content

Create a Currency

POST 

https://useast.api.elasticpath.com/v2/currencies

Create a currency.

Request

Body

    data object
    codestringrequired

    Specifies the currency code. Example YEN.

    Possible values: >= 3 characters and <= 3 characters

    Example: GBP
    decimal_placesnumberrequired

    Indicates how many decimal places the currency is formatted to.

    Example: 2
    decimal_pointstringrequired

    Indicates the decimal point character.

    Example: .
    defaultbooleanrequired

    Specifies whether this is the default currency or not. Either true or false.

    Example: true
    enabledbooleanrequired

    Specifies if this currency is available for products. Either true or false.

    Example: true
    exchange_ratenumberrequired

    Specifies the exchange rate from the default currency.

    Example: 1
    formatstringrequired

    Specifies how the price currency is displayed. For example, "¥{price}".

    Example: £{price}
    thousand_separatorstringrequired

    Indicates the thousand separator character.

    Example: ,
    typestringrequired

    Represents the type represents the object being returned.

    Example: currency

Responses

Created

Schema
    data object
    idstring

    The unique identifier for this currency.

    Example: 0c45e4ec-26e0-4043-86e4-c15b9cf985a0
    typestring

    Represents the type represents the object being returned.

    Example: currency
    codestring

    Specifies the currency code. For example, YEN.

    Example: GBP
    exchange_ratenumber

    Specifies the exchange rate from the default currency.

    Example: 1
    formatstring

    Specifies how the price currency is displayed. For example, "£{price}".

    Example: £{price}
    decimal_pointstring

    Indicates the decimal point character.

    Example: .
    thousand_separatorstring

    Indicates the thousand separator character.

    Example: ,
    decimal_placesnumber

    Indicates how many decimal places the currency is formatted to.

    Example: 2
    defaultboolean

    Specifies whether this is the default currency or not. Either true or false.

    Example: true
    enabledboolean

    Specifies if this currency is available for products. Either true or false.

    Example: true
    links object
    selfstring

    Specifies the URL of this currency.

    meta object
    timestamps object
    created_atstring

    Indicates the creation date of this currency.

    Example: 2023-11-07T23:04:18.845Z
    updated_at

    Indicates the updated date of this currency.

    Example: 2023-11-07T23:04:18.845Z
    ownerstring

    Indicates whether the owner is store or org.

    Example: store

Authorization: http

name: bearerAuthtype: httpscheme: bearer
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://useast.api.elasticpath.com/v2/currencies");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("[\n {\n \"data\": {\n \"code\": \"GBP\",\n \"decimal_places\": 2,\n \"decimal_point\": \".\",\n \"default\": true,\n \"enabled\": true,\n \"exchange_rate\": 1,\n \"format\": \"£{price}\",\n \"thousand_separator\": \",\",\n \"type\": \"currency\"\n }\n }\n]", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Request Collapse all
Base URL
https://useast.api.elasticpath.com
Auth
Body
[
  {
    "data": {
      "code": "GBP",
      "decimal_places": 2,
      "decimal_point": ".",
      "default": true,
      "enabled": true,
      "exchange_rate": 1,
      "format": "£{price}",
      "thousand_separator": ",",
      "type": "currency"
    }
  }
]
ResponseClear

Click the Send API Request button above and see the response here!