Skip to main content

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

ParameterTypeRequiredDescription
nameStringNoA tag for the wallet. Must be at least 3 characters.
organisationIdStringYesOrganisation ID of the organisation that owns the API Key

Request Sample

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

FieldTypeDescription
idStringThe unique identifier of the api key.
secretStringThe secret associated with the api key.
nameStringThe name associated with the wallet.
activeBooleanIndicates whether the wallet is active.
organizationIdStringThe 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"
}