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
List of users
Bad request error
Unauthorized error
Too many requests error
Internal server error
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"
}
]
}
User details
Bad request error
Unauthorized error
Not found error
Not acceptable error
Unprocessable entity error
Too many requests error
Internal server error
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"
}
]
}
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
User details
Bad request error
Unauthorized error
Not found error
Not acceptable error
Unprocessable entity error
Too many requests error
Internal server error
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"
}
]
}
JSON defining a User object
John Doe
Pattern: ^[a-z ,.'-]+$
password123
Pattern: ^[a-zA-Z0-9]*$
User created successfully
Bad request error
Unauthorized error
Not acceptable error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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"
}
]
}
JSON defining a User object
password123
Pattern: ^[a-zA-Z0-9]*$
John Doe
Pattern: ^[a-z ,.'-]+$
User updated successfully
Bad request error
Unauthorized error
Forbidden error
Not found error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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
List of transactions
Bad request error
Unauthorized error
Too many requests error
Internal server error
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"
}
]
b92787c0-3525-4e2a-96f4-9d0d13123e5e
Pattern: ^[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}$
Transaction details
Bad request error
Unauthorized error
Not found error
Not acceptable error
Unprocessable entity error
Too many requests error
Internal server error
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"
}
List of transactions by date
Bad request error
Unauthorized error
Too many requests error
Internal server error
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"
}
]
List of transactions by date range
Bad request error
Unauthorized error
Too many requests error
Internal server error
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"
}
]
0xabcdef1234567890abcdef1234567890abcdef12
Pattern: ^0x[a-fA-F0-9]{40}$
0xabcdef1234567890abcdef1234567890abcdef12
Pattern: ^0x[a-fA-F0-9]{40}$
10
Transaction started successfully
Bad request error
Unauthorized error
Not acceptable error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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"
}
}
]
}
b92787c0-3525-4e2a-96f4-9d0d13123e5e
Pattern: ^[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}$
0xabcdef1234567890abcdef1234567890abcdef12
Pattern: ^0x[a-fA-F0-9]{40}$
0xabcdef1234567890abcdef1234567890abcdef12
Pattern: ^0x[a-fA-F0-9]{40}$
10
pending
Possible values: 2024-01-01T00:00:00Z
2024-01-01T00:00:00Z
Transaction signed successfully
Bad request error
Unauthorized error
Not acceptable error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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"
}
b92787c0-3525-4e2a-96f4-9d0d13123e5e
Pattern: ^[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}$
0xf9020e128509742328a88307a12094287c676e7c51556d0820a1f049f74aa3a206fa8880b901a484bb1e420000000000000000000000001bfad07c5118fbcc96ef6baf12d2945ca9d2548c000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000080ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000083027127a07b8b49ac49c2c862a697954115d244795d56e34c8e49410b79f1dafaf2b81548a07b397d0cd1f17edbfb8de38972fb2cedf713e1acab8542c951c75a208fe86f65
Pattern: ^[a-zA-Z0-9]*$
Transaction finished successfully
Bad request error
Unauthorized error
Forbidden error
Not found error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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
List of contracts
Bad request error
Unauthorized error
Too many requests error
Internal server error
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
}
]
List of active contracts
Bad request error
Unauthorized error
Too many requests error
Internal server error
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
}
]
Contract details
Bad request error
Unauthorized error
Not found error
Not acceptable error
Unprocessable entity error
Too many requests error
Internal server error
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
}
Contract details
Bad request error
Not found error
Not acceptable error
Unprocessable entity error
Too many requests error
Internal server error
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
}
0x1234567890abcdef1234567890abcdef12345678
Pattern: ^0x[a-fA-F0-9]{40}$
1
ERC20
["0xabcdef1234567890abcdef1234567890abcdef12"]
["0xabcdef1234567890abcdef1234567890abcdef12"]
["0xabcdef1234567890abcdef1234567890abcdef12"]
Contract created successfully
Bad request error
Unauthorized error
Not acceptable error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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
}
true
Contract activeness updated successfully
Bad request error
Unauthorized error
Forbidden error
Not found error
Conflict error
Unprocessable entity error
Too many requests error
Internal server error
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