Create API Key
This API endpoint allows you to create API keys for organistion from Maschain Backend.
HTTP Method
POST
/maschain/api-key/create
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | String | No | A tag for the wallet. Must be at least 3 characters. |
organisationId | String | Yes | Organisation ID of the organisation that owns the API Key |
Request Sample
- Node.js (Fetch)
const fetch = require("node-fetch");
const createApiKey = async () => {
const response = await fetch("https://wallet-api.samudera.blox.my/api/maschain/api-key/create", {
method: "POST",
headers: {
"maschain-api-key": process.env.MASCHAIN_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
name: "organization dapp",
organisationId: "org_12345",
}),
});
if (!response.ok) {
const error = await response.json();
console.error("Error:", error);
return;
}
const result = await response.json();
console.log("Success:", result);
};
createApiKey();
Response
Success Response
Status Code:
200
| Field | Type | Description |
|---|---|---|
id | String | The unique identifier of the api key. |
secret | String | The secret associated with the api key. |
name | String | The name associated with the wallet. |
active | Boolean | Indicates whether the wallet is active. |
organizationId | String | The organization ID linked to the wallet. |
Example Response:
{
"id": "clzvkpvql0001o2t5hpqg9a7y",
"tag": "organization",
"metadata": {},
"active": true,
"organizationId": "org_12345",
"address": "0x1234567890abcdef1234567890abcdef12345678",
"createdAt": "2024-12-10T12:00:00.000Z"
}