🌱 This is a live document. Continuous updates are forthcoming!

Documentation
Develop
Dapp
SelSwap
API
Organization

Organization

Organization Creation

This API endpoint allows authenticated users to create a new organization.

It requires authentication using a valid access token (implement isAuthenticated middleware).

API ENDPOINTS

Request Body:

FieldTypeDescriptionRequired
namestringThe desired name for the organization.Yes
logoString (URL)The URL of the organization's logo image.Yes

API example

const axios = require("axios");
let data = JSON.stringify({
  name: "selendra",
  logo: "https://gateway.selendra.org/public/images/selendra.png",
});
 
let config = {
  method: "post",
  url: "https://gateway.selendra.org/org/create",
  headers: {
    Authorization: token,
    "Content-Type": "application/json",
  },
  data: data,
};
 
axios
  .request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

Response Example (Success):

{
  "status": "SUCCESS",
  "data": {
    "id": "org_12345",
    "name": "selendra",
    "logo": "https://gateway.selendra.org/public/images/selendra.png",
    "owner_id": "user_abcde",
    "merchant_id": "myawesomeorganization",
    "api_key": "your_api_key"
  }
}
Note

data.id: Unique identifier for the created organization.
data.name: The name of the organization.
data.logo: The URL of the organization's logo image.
data.owner_id: The user ID of the organization owner.
data.merchant_id: A unique identifier generated from the organization name.
data.api_key: The API key for the newly created organization.
data.token_id: An internal identifier assigned to the organization.

Response Example (Error):

{
  "status": "ERROR",
  "message": "name and logo are required"
}

Code Errors:

  • 400: Bad Request - This indicates that the request body is invalid or missing required fields.
  • 401: Unauthorized - Authentication failed (invalid or missing access token).
  • 409: Conflict - Organization name already exists.

Whitelist Partners

This API endpoint allows authenticated users to add a partner organization to their whitelist. It requires authentication using a valid access token (implement isAuthenticated middleware).

API ENDPOINTS

Request Body:

FieldTypeDescriptionRequired
api_keystringThe API key of the organization.Yes
merchant_idString (URL)The merchant ID of the organization.Yes
partner_token_idNumberThe token ID of the partner organization to be added to the whitelist.Yes

API example

const axios = require("axios");
let data = JSON.stringify({
  api_key: "39902810-bda0-49a6-9301-979ec7e29a52",
  merchant_id: "koompi",
  partner_token_id: "2",
});
 
let config = {
  method: "post",
  maxBodyLength: Infinity,
  url: "https://gateway.selendra.org/org/add/whitelist",
  headers: {
    Authorization: token,
    "Content-Type": "application/json",
  },
  data: data,
};
 
axios
  .request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });

Success Response:

{
  "status": "SUCCESS",
  "message": "Partner ID added successfully"
}

Error Response:

{
  "status": "ERROR",
  "message": "Invalid merchant_id or api_key"
}

Code Errors:

  • 400: Bad Request - Invalid request body or missing required fields.
  • 401: Unauthorized - Authentication failed (invalid or missing access token).
  • 404: Not Found - Partner token not found, or other data related errors.
  • 409: Conflict - Partner already added, or attempting to whitelist own token.