API Documentation

Welcome to the API documentation for managing Users, Transactions, and Token Contracts. This API allows developers to interact with the app programmatically, enabling functionalities such as user management, token transactions, and retrieval of token contract information.

Authentication

This API uses JWT for authentication along with an API key. Every request to the API must include a valid JWT in the Authorization header and an API key in the X-API-Key header.

  • JWT: The JWT should be included in the Authorization header as a Bearer token.

  • API Key: The API key should be included in the X-API-Key header.

Base URL

The base URL for the API is:

https://api.sonica.xyz/v0/rwa

Available Endpoints

Getting Started

To begin using the API, you need to obtain an API key and generate a JWT token. Include these credentials in your requests to authenticate and interact with the endpoints. Each endpoint description in this documentation includes details about the required parameters, request body, and response structure.


User

Get all users

get
Authorizations
Responses
200

List of users

application/json
get
GET /v0/rwa/users HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
{
  "type": "ok",
  "title": "SuccessfulRequest",
  "status": 200,
  "data": [
    {
      "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
      "email": "[email protected]",
      "fullName": "John Doe",
      "walletAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
      "role": "user",
      "lastLoginAt": "2024-01-01T00:00:00Z",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Get a user by ID

get
Authorizations
Path parameters
idintegerRequired
Responses
200

User details

application/json
get
GET /v0/rwa/user/{id} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
{
  "type": "ok",
  "title": "SuccessfulRequest",
  "status": 200,
  "data": [
    {
      "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
      "email": "[email protected]",
      "fullName": "John Doe",
      "walletAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
      "role": "user",
      "lastLoginAt": "2024-01-01T00:00:00Z",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Get a user by email

get
Authorizations
Path parameters
emailstring · max: 255RequiredPattern: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Responses
200

User details

application/json
get
GET /v0/rwa/user/email/{email} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
{
  "type": "ok",
  "title": "SuccessfulRequest",
  "status": 200,
  "data": [
    {
      "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
      "email": "[email protected]",
      "fullName": "John Doe",
      "walletAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
      "role": "user",
      "lastLoginAt": "2024-01-01T00:00:00Z",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Create a new user

post
Authorizations
Body

JSON defining a User object

fullNamestring · max: 255RequiredExample: John DoePattern: ^[a-z ,.'-]+$
emailstring · max: 255RequiredExample: [email protected]Pattern: ^[^@\s]+@[^@\s]+\.[^@\s]+$
passwordstring · password · max: 255RequiredExample: password123Pattern: ^[a-zA-Z0-9]*$
Responses
200

User created successfully

application/json
post
POST /v0/rwa/user HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 75

{
  "fullName": "John Doe",
  "email": "[email protected]",
  "password": "password123"
}
{
  "type": "ok",
  "title": "SuccessfulRequest",
  "status": 200,
  "data": [
    {
      "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
      "email": "[email protected]",
      "fullName": "John Doe",
      "walletAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
      "role": "user",
      "lastLoginAt": "2024-01-01T00:00:00Z",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Update a user by ID

put
Authorizations
Path parameters
idstringRequired
Body

JSON defining a User object

emailstring · max: 255OptionalExample: [email protected]Pattern: ^[^@\s]+@[^@\s]+\.[^@\s]+$
passwordstring · password · max: 255OptionalExample: password123Pattern: ^[a-zA-Z0-9]*$
fullNamestring · max: 255OptionalExample: John DoePattern: ^[a-z ,.'-]+$
Responses
200

User updated successfully

application/json
put
PUT /v0/rwa/user/{id} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 75

{
  "email": "[email protected]",
  "password": "password123",
  "fullName": "John Doe"
}
{
  "type": "ok",
  "title": "SuccessfulRequest",
  "status": 200,
  "data": [
    {
      "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
      "email": "[email protected]",
      "fullName": "John Doe",
      "walletAddress": "0xabcdef1234567890abcdef1234567890abcdef12",
      "role": "user",
      "lastLoginAt": "2024-01-01T00:00:00Z",
      "createdAt": "2024-01-01T00:00:00Z",
      "updatedAt": "2024-01-01T00:00:00Z"
    }
  ]
}

Transactions

Get all transactions

get
Authorizations
Responses
200

List of transactions

application/json
get
GET /v0/rwa/transactions HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
[
  {
    "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
    "to": "0xabcdef1234567890abcdef1234567890abcdef12",
    "tokenHash": "0xabcdef1234567890abcdef1234567890abcdef12",
    "amount": 10,
    "status": "pending",
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z"
  }
]

Get a transaction by ID

get
Authorizations
Path parameters
transactionIdstring · max: 36RequiredExample: b92787c0-3525-4e2a-96f4-9d0d13123e5ePattern: ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
Responses
200

Transaction details

application/json
get
GET /v0/rwa/transaction/{transactionId} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "to": "0xabcdef1234567890abcdef1234567890abcdef12",
  "tokenHash": "0xabcdef1234567890abcdef1234567890abcdef12",
  "amount": 10,
  "status": "pending",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z"
}

Get transactions by date

get
Authorizations
Responses
200

List of transactions by date

application/json
get
GET /v0/rwa/transactions/date HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
[
  {
    "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
    "to": "0xabcdef1234567890abcdef1234567890abcdef12",
    "tokenHash": "0xabcdef1234567890abcdef1234567890abcdef12",
    "amount": 10,
    "status": "pending",
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z"
  }
]

Get transactions by date range

get
Authorizations
Responses
200

List of transactions by date range

application/json
get
GET /v0/rwa/transactions/range HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
[
  {
    "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
    "to": "0xabcdef1234567890abcdef1234567890abcdef12",
    "tokenHash": "0xabcdef1234567890abcdef1234567890abcdef12",
    "amount": 10,
    "status": "pending",
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z"
  }
]

Start a buy transaction

post
Authorizations
Body
tostring · max: 42RequiredExample: 0xabcdef1234567890abcdef1234567890abcdef12Pattern: ^0x[a-fA-F0-9]{40}$
tokenHashstring · max: 42RequiredExample: 0xabcdef1234567890abcdef1234567890abcdef12Pattern: ^0x[a-fA-F0-9]{40}$
amountnumber · float · max: 1000RequiredExample: 10
Responses
200

Transaction started successfully

application/json
post
POST /v0/rwa/transaction/buy/start HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 120

{
  "to": "0xabcdef1234567890abcdef1234567890abcdef12",
  "tokenHash": "0xabcdef1234567890abcdef1234567890abcdef12",
  "amount": 10
}
{
  "type": "ok",
  "title": "SuccessfulRequest",
  "status": 200,
  "data": [
    {
      "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
      "transaction": {
        "data": "0x84bb1e420000000000000000000000001bfad07c5118fbcc96ef6baf12d2945ca9d2548c000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000080ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000",
        "to": "0xabcdef1234567890abcdef1234567890abcdef12"
      }
    }
  ]
}

Sign a transaction

post
Authorizations
Body
idstring · max: 36OptionalExample: b92787c0-3525-4e2a-96f4-9d0d13123e5ePattern: ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
tostring · max: 42OptionalExample: 0xabcdef1234567890abcdef1234567890abcdef12Pattern: ^0x[a-fA-F0-9]{40}$
tokenHashstring · max: 42OptionalExample: 0xabcdef1234567890abcdef1234567890abcdef12Pattern: ^0x[a-fA-F0-9]{40}$
amountnumber · float · max: 1000OptionalExample: 10
statusstring · enumOptionalExample: pendingPossible values:
createdAtstring · date-time · max: 20OptionalExample: 2024-01-01T00:00:00Z
updatedAtstring · date-time · max: 20OptionalExample: 2024-01-01T00:00:00Z
Responses
200

Transaction signed successfully

application/json
post
POST /v0/rwa/transaction/sign HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 253

{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "to": "0xabcdef1234567890abcdef1234567890abcdef12",
  "tokenHash": "0xabcdef1234567890abcdef1234567890abcdef12",
  "amount": 10,
  "status": "pending",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z"
}
{
  "transaction": "0xf9020e128509742328a88307a12094287c676e7c51556d0820a1f049f74aa3a206fa8880b901a484bb1e420000000000000000000000001bfad07c5118fbcc96ef6baf12d2945ca9d2548c000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000080ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000083027127a07b8b49ac49c2c862a697954115d244795d56e34c8e49410b79f1dafaf2b81548a07b397d0cd1f17edbfb8de38972fb2cedf713e1acab8542c951c75a208fe86f65"
}

Finish a buy transaction

put
Authorizations
Path parameters
transactionIdstring · max: 36RequiredExample: b92787c0-3525-4e2a-96f4-9d0d13123e5ePattern: ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$
Body
transactionstring · max: 1000RequiredExample: 0xf9020e128509742328a88307a12094287c676e7c51556d0820a1f049f74aa3a206fa8880b901a484bb1e420000000000000000000000001bfad07c5118fbcc96ef6baf12d2945ca9d2548c000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000080ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000083027127a07b8b49ac49c2c862a697954115d244795d56e34c8e49410b79f1dafaf2b81548a07b397d0cd1f17edbfb8de38972fb2cedf713e1acab8542c951c75a208fe86f65Pattern: ^[a-zA-Z0-9]*$
Responses
200

Transaction finished successfully

application/json
put
PUT /v0/rwa/transaction/buy/finish/{transactionId} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1078

{
  "transaction": "0xf9020e128509742328a88307a12094287c676e7c51556d0820a1f049f74aa3a206fa8880b901a484bb1e420000000000000000000000001bfad07c5118fbcc96ef6baf12d2945ca9d2548c000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000080ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000083027127a07b8b49ac49c2c862a697954115d244795d56e34c8e49410b79f1dafaf2b81548a07b397d0cd1f17edbfb8de38972fb2cedf713e1acab8542c951c75a208fe86f65"
}
{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "status": "completed",
  "description": "Transaction completed successfully",
  "createdAt": "2024-01-01T00:00:00Z",
  "updatedAt": "2024-01-01T00:00:00Z"
}

Token Contracts

Get all contracts

get
Authorizations
Responses
200

List of contracts

application/json
get
GET /v0/rwa/contracts HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
[
  {
    "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
    "address": "0x1234567890abcdef1234567890abcdef12345678",
    "network": 1,
    "type": "ERC20",
    "admins": [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ],
    "editors": [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ],
    "hidden": [
      [
        "0xabcdef1234567890abcdef1234567890abcdef12"
      ]
    ],
    "isActive": true
  }
]

Get all active contracts

get
Authorizations
Responses
200

List of active contracts

application/json
get
GET /v0/rwa/contracts/active HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
[
  {
    "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
    "address": "0x1234567890abcdef1234567890abcdef12345678",
    "network": 1,
    "type": "ERC20",
    "admins": [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ],
    "editors": [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ],
    "hidden": [
      [
        "0xabcdef1234567890abcdef1234567890abcdef12"
      ]
    ],
    "isActive": true
  }
]

Get a contract by ID

get
Authorizations
Path parameters
idstringRequired
Responses
200

Contract details

application/json
get
GET /v0/rwa/contract/{id} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "network": 1,
  "type": "ERC20",
  "admins": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "editors": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "hidden": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ],
  "isActive": true
}

Get a contract by network and address

get
Authorizations
Path parameters
networkintegerRequired
addressstringRequired
Responses
200

Contract details

application/json
get
GET /v0/rwa/contract/{network}/{address} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Accept: */*
{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "network": 1,
  "type": "ERC20",
  "admins": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "editors": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "hidden": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ],
  "isActive": true
}

Create a new contract

post
Authorizations
Body
addressstring · max: 42RequiredExample: 0x1234567890abcdef1234567890abcdef12345678Pattern: ^0x[a-fA-F0-9]{40}$
networkintegerRequiredExample: 1
typestringRequiredExample: ERC20
adminsstring[]RequiredExample: ["0xabcdef1234567890abcdef1234567890abcdef12"]
editorsstring[]RequiredExample: ["0xabcdef1234567890abcdef1234567890abcdef12"]
hiddenstring[]OptionalExample: ["0xabcdef1234567890abcdef1234567890abcdef12"]
Responses
200

Contract created successfully

application/json
post
POST /v0/rwa/contract HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 258

{
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "network": 1,
  "type": "ERC20",
  "admins": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ],
  "editors": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ],
  "hidden": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ]
}
{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "network": 1,
  "type": "ERC20",
  "admins": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "editors": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "hidden": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ],
  "isActive": true
}

Update contract activeness by network and address

put
Authorizations
Path parameters
networkintegerRequired
addressstringRequired
Body
isActivebooleanRequiredExample: true
Responses
200

Contract activeness updated successfully

application/json
put
PUT /v0/rwa/contract/{network}/{address} HTTP/1.1
Host: api.sonica.xyz
api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 17

{
  "isActive": true
}
{
  "id": "b92787c0-3525-4e2a-96f4-9d0d13123e5e",
  "address": "0x1234567890abcdef1234567890abcdef12345678",
  "network": 1,
  "type": "ERC20",
  "admins": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "editors": [
    "0xabcdef1234567890abcdef1234567890abcdef12"
  ],
  "hidden": [
    [
      "0xabcdef1234567890abcdef1234567890abcdef12"
    ]
  ],
  "isActive": true
}

Last updated