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
api-keystringRequired

Bearer token

Responses
200

List of users

application/json
get
/v0/rwa/users

Get a user by ID

get
Authorizations
api-keystringRequired

Bearer token

Path parameters
idintegerRequired
Responses
200

User details

application/json
get
/v0/rwa/user/{id}

Get a user by email

get
Authorizations
api-keystringRequired

Bearer token

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

User details

application/json
get
/v0/rwa/user/email/{email}

Create a new user

post
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/user

Update a user by ID

put
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/user/{id}

Transactions

Get all transactions

get
Authorizations
api-keystringRequired

Bearer token

Responses
200

List of transactions

application/json
get
/v0/rwa/transactions

Get a transaction by ID

get
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/transaction/{transactionId}

Get transactions by date

get
Authorizations
api-keystringRequired

Bearer token

Responses
200

List of transactions by date

application/json
get
/v0/rwa/transactions/date

Get transactions by date range

get
Authorizations
api-keystringRequired

Bearer token

Responses
200

List of transactions by date range

application/json
get
/v0/rwa/transactions/range

Start a buy transaction

post
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/transaction/buy/start

Sign a transaction

post
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/transaction/sign

Finish a buy transaction

put
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/transaction/buy/finish/{transactionId}

Token Contracts

Get all contracts

get
Authorizations
api-keystringRequired

Bearer token

Responses
200

List of contracts

application/json
get
/v0/rwa/contracts

Get all active contracts

get
Authorizations
api-keystringRequired

Bearer token

Responses
200

List of active contracts

application/json
get
/v0/rwa/contracts/active

Get a contract by ID

get
Authorizations
api-keystringRequired

Bearer token

Path parameters
idstringRequired
Responses
200

Contract details

application/json
get
/v0/rwa/contract/{id}

Get a contract by network and address

get
Authorizations
api-keystringRequired

Bearer token

Path parameters
networkintegerRequired
addressstringRequired
Responses
200

Contract details

application/json
get
/v0/rwa/contract/{network}/{address}

Create a new contract

post
Authorizations
api-keystringRequired

Bearer token

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
/v0/rwa/contract

Update contract activeness by network and address

put
Authorizations
api-keystringRequired

Bearer token

Path parameters
networkintegerRequired
addressstringRequired
Body
isActivebooleanRequiredExample: true
Responses
200

Contract activeness updated successfully

application/json
put
/v0/rwa/contract/{network}/{address}

Last updated