Links

Server API

The Server API provides useful APIs to support application use. It follows a JSON-RPC 2.0 standard.

Endpoint

The Server RPC URL is:
https://api.particle.network/server/rpc

Authentication

Methods

🔥
getUserInfo

Obtain user info by uuid and token
Use this API to integrate Particle Auth into your user ID system
🎉
Parameters:
  • <string> - user uuid
  • <string> - user token
Results:
  • <object> - a JSON object containing:
    • uuid: <string>, user uuid
    • phone: <string>, user phone number
    • email: <string>, user email
    • name: <string>, user name
    • avatar: <string>, user avatar url
    • facebookId: <string>, exist when user login with facebook
    • facebookEmail: <string>
    • googleId: <string>, exist when user login with google
    • googleEmail: <string>
    • appleId: <string>, exist when user login with apple
    • appleEmail: <string>
    • twitterId: <string>, exist when user login with twitter
    • twitterEmail: <string>
    • telegramId: <string>, exist when user login with telegram
    • telegramPhone: <string>
    • discordId: <string>, exist when user login with discord
    • discordEmail: <string>
    • githubId: <string>, exist when user login with github
    • githubEmail: <string>
    • twitchId: <string>, exist when user login with twitch
    • twitchEmail: <string>
    • miscrosoftId: <string>, exist when user login with miscrosoft
    • miscrosoftEmail: <string>
    • linkedinId: <string>, exist when user login with linkedin
    • linkedinEmail: <string>
    • jwtId: <string>, exist when user login with JWT(Custom Auth)
      • Format: projectId + : + jwt unique id
    • wallets: <[object]>, user wallets with public address

Request example:

Javascript
Curl
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "getUserInfo",
params: ["Particle Auth User Uuid", "Particle Auth User Token"],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
curl 'https://api.particle.network/server/rpc' \
--header 'Authorization: Basic YmEwNTA5ZTctZThiYi00MzY2LTg5YjctYjM5ZjAyYmNkMDg0OmNnZjE4YXNMbG9zSkJzZlZXbWxvNHNuZ2lFRVZzc1gzNHFlTUxmZzQ=' \
-X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":0,"method":"getUserInfo","params":["Particle Auth User Uuid", "Particle Auth User Token"]}
'
Response example:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"uuid": "2d7b1ff2-0791-4fd2-a26e-16fbcaefdf8a",
"phone": null,
"email": "[email protected]",
"name": null,
"avatar": null,
"facebookId": null,
"facebookEmail": null,
"googleId": null,
"googleEmail": null,
"appleId": null,
"appleEmail": null,
"twitterId": null,
"twitterEmail": null,
"telegramId": null,
"telegramPhone": null,
"discordId": null,
"discordEmail": null,
"githubId": null,
"githubEmail": null,
"twitchId": null,
"twitchEmail": null,
"microsoftId": null,
"microsoftEmail": null,
"linkedinId": null,
"linkedinEmail": null,
"createdAt": "2022-06-08T07:47:54.000Z",
"updatedAt": "2022-06-08T07:47:55.000Z",
"wallets": [
{
"chain": "evm_chain",
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF"
},
{
"chain": "solana",
"publicAddress": "3k61BRDo253SF1XuknbBSUh8FvFqJkcMYzmZuvMMhCC1"
}
]
}
}

🔥
lockUserWallet

Lock user wallet transactions for a contract/program up for a while
Parameters:
  • <string> - user uuid
  • <string> - user token
  • <object> - a JSON object containing:
    • chain: <string>, wallets chain name, the type value is as below
      • solana
      • evm_chain
    • chainId: <uint64>, chain id, see 👉 ChainId Configs
    • publicAddress: <string>, user wallet public address
    • contractAddress: <string>, your contract/program address
    • time: <uint64>, lock time(seconds), and max lock time is 86400(24hours)
Only verified contract can be locked for user wallet, please add and verify your contract/program address first 👉 Dashboard, and testnet will not check the contract is verified.
Results:
empty string

Request example:

Javascript
Curl
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "lockUserWallet",
params: ["Particle Auth User Uuid", "Particle Auth User Token", {
"chain": "evm_chain",
"chainId": 42,
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF",
"contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62",
"time": 3600
}],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
curl 'https://api.particle.network/server/rpc' \
--header 'Authorization: Basic YmEwNTA5ZTctZThiYi00MzY2LTg5YjctYjM5ZjAyYmNkMDg0OmNnZjE4YXNMbG9zSkJzZlZXbWxvNHNuZ2lFRVZzc1gzNHFlTUxmZzQ=' \
-X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":0,"method":"getUserInfo","params":["Particle Auth User Uuid", "Particle Auth User Token", {"chain": "evm_chain", "chainId": 42, "publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF", "contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62", "time": 3600}]}
'
Response example:
{
"jsonrpc": "2.0",
"id": 1,
"result": ""
}

🔥
unlockUserWallet

Unlock user wallet transactions for a contract/program
Parameters:
  • <string> - user uuid
  • <string> - user token
  • <object> - a JSON object containing:
    • chain: <string>, wallets chain name, the type value is as below
      • solana
      • evm_chain
    • chainId: <uint64>, chain id, see Structure for solana, Structure for evm-chains
    • publicAddress: <string>, user wallet public address
    • contractAddress: <string>, your contract/program address
Only verified contract can be locked for user wallet, please add and verify your contract/program address first 👉 Dashboard, and testnet will not check the contract is verified.
Results:
empty string

Request example:

Javascript
Curl
const axios = require("axios");
(async () => {
const response = await axios.post(
"https://api.particle.network/server/rpc",
{
jsonrpc: "2.0",
id: 0,
method: "unlockUserWallet",
params: ["Particle Auth User Uuid", "Particle Auth User Token", {
"chain": "evm_chain",
"chainId": 42,
"publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF",
"contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62"
}],
},
{
auth: {
username: "Your Project Id",
password: "Your Project Server Key",
},
}
);
console.log(response.data);
})();
curl 'https://api.particle.network/server/rpc' \
--header 'Authorization: Basic YmEwNTA5ZTctZThiYi00MzY2LTg5YjctYjM5ZjAyYmNkMDg0OmNnZjE4YXNMbG9zSkJzZlZXbWxvNHNuZ2lFRVZzc1gzNHFlTUxmZzQ=' \
-X POST -H "Content-Type: application/json" -d '
{"jsonrpc":"2.0","id":0,"method":"getUserInfo","params":["Particle Auth User Uuid", "Particle Auth User Token", {"chain": "evm_chain", "chainId": 42, "publicAddress": "0x6D5fCEd0C74F22a1B145ef48B25527Ce9BF829bF", "contractAddress": "0x27833fBD4FA313A11653D1D2372cB89f5f2D2f62"}]}
'
Response example:
{
"jsonrpc": "2.0",
"id": 1,
"result": ""
}

Errors