Sign In

POST /v1/format

Format ForgeScript code snippets with clean indentation.

Public Endpoints API Key (X-API-Key)

Endpoint

https://api.botforge.org/v1/format

Request Body

Field Type Required Description
code String Yes The ForgeScript source code to format.
indent Integer No Indentation width in spaces.
wrap Boolean No Wrap output in a code block.

Examples

cURL

curl -X POST "https://api.botforge.org/v1/format" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "code": "<string>",
  "indent": "<integer>",
  "wrap": "<boolean>"
}'

JavaScript / TypeScript

const res = await fetch("https://api.botforge.org/v1/format", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
  "code": "<string>",
  "indent": "<integer>",
  "wrap": "<boolean>"
}),
});
const data = await res.json();

Response Example

{
  "success": true,
  "formattedCode": "$if[$authorID==123;$sendMessage[$channelID;Hi]]",
  "changed": false,
  "originalLength": 47,
  "formattedLength": 47,
  "sourceType": "raw",
  "color": "#57f287"
}

Was this page helpful?