Create a new asset
curl --request POST \
--url https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "USD",
"metadata": {},
"name": "US Dollar",
"status": {
"code": "ACTIVE",
"description": "Active status"
},
"type": "currency"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets"
payload := strings.NewReader("{\n \"code\": \"USD\",\n \"metadata\": {},\n \"name\": \"US Dollar\",\n \"status\": {\n \"code\": \"ACTIVE\",\n \"description\": \"Active status\"\n },\n \"type\": \"currency\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: 'USD',
metadata: {},
name: 'US Dollar',
status: {code: 'ACTIVE', description: 'Active status'},
type: 'currency'
})
};
fetch('https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets"
payload = {
"code": "USD",
"metadata": {},
"name": "US Dollar",
"status": {
"code": "ACTIVE",
"description": "Active status"
},
"type": "currency"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"code": "USD",
"createdAt": "2021-01-01T00:00:00Z",
"deletedAt": "2021-01-01T00:00:00Z",
"id": "00000000-0000-0000-0000-000000000000",
"ledgerId": "00000000-0000-0000-0000-000000000000",
"name": "US Dollar",
"organizationId": "00000000-0000-0000-0000-000000000000",
"status": {
"code": "ACTIVE",
"description": "Active status"
},
"type": "currency",
"updatedAt": "2021-01-01T00:00:00Z",
"metadata": {}
}{
"code": "<string>",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}{
"code": "<string>",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}{
"code": "<string>",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}Create a new asset
POST
/
v2
/
organizations
/
{organization_id}
/
ledgers
/
{ledger_id}
/
assets
Create a new asset
curl --request POST \
--url https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "USD",
"metadata": {},
"name": "US Dollar",
"status": {
"code": "ACTIVE",
"description": "Active status"
},
"type": "currency"
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets"
payload := strings.NewReader("{\n \"code\": \"USD\",\n \"metadata\": {},\n \"name\": \"US Dollar\",\n \"status\": {\n \"code\": \"ACTIVE\",\n \"description\": \"Active status\"\n },\n \"type\": \"currency\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
code: 'USD',
metadata: {},
name: 'US Dollar',
status: {code: 'ACTIVE', description: 'Active status'},
type: 'currency'
})
};
fetch('https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://ledger.sandbox.lerian.net/v2/organizations/{organization_id}/ledgers/{ledger_id}/assets"
payload = {
"code": "USD",
"metadata": {},
"name": "US Dollar",
"status": {
"code": "ACTIVE",
"description": "Active status"
},
"type": "currency"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"code": "USD",
"createdAt": "2021-01-01T00:00:00Z",
"deletedAt": "2021-01-01T00:00:00Z",
"id": "00000000-0000-0000-0000-000000000000",
"ledgerId": "00000000-0000-0000-0000-000000000000",
"name": "US Dollar",
"organizationId": "00000000-0000-0000-0000-000000000000",
"status": {
"code": "ACTIVE",
"description": "Active status"
},
"type": "currency",
"updatedAt": "2021-01-01T00:00:00Z",
"metadata": {}
}{
"code": "<string>",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}{
"code": "<string>",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}{
"code": "<string>",
"detail": "Property foo is required but is missing.",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
],
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "https://example.com/errors/example",
"upstream": {
"code": "E4001",
"message": "account not found at provider"
}
}Authorizations
JWT bearer token issued by the identity provider.
Headers
Bearer token (forwarded to the service)
Path Parameters
Organization ID (UUID)
Ledger ID (UUID)
Body
application/json
Response
Created
Maximum string length:
100Example:
"USD"
Example:
"2021-01-01T00:00:00Z"
Example:
"2021-01-01T00:00:00Z"
Example:
"00000000-0000-0000-0000-000000000000"
Example:
"00000000-0000-0000-0000-000000000000"
Maximum string length:
256Example:
"US Dollar"
Example:
"00000000-0000-0000-0000-000000000000"
Show child attributes
Show child attributes
Example:
"currency"
Example:
"2021-01-01T00:00:00Z"
Show child attributes
Show child attributes
Was this page helpful?

