Sign In

POST /v1/validate

Validate ForgeScript code against all package metadata and report syntax issues, operator prefixes, bracket errors, and argument mismatches.

Public Endpoints API Key (X-API-Key)

Endpoint

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

Request Body

Field Type Required Description
code String Yes The ForgeScript source code to validate.
package String No Restrict catalog lookup to a single package.
branch String No Target branch ("main", "dev", etc.).
strict Boolean No Report unknown $-functions as errors.

Examples

cURL

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

JavaScript / TypeScript

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

Response Example

{
  "success": true,
  "code": "$sendMessage[$channelID;Hello!]",
  "cleanCode": "$sendMessage[$channelID;Hello!]",
  "isCodeBlock": false,
  "totalIssues": 0,
  "errorsCount": 0,
  "warningsCount": 0,
  "hintsCount": 0,
  "hasIssues": false,
  "headerText": "### <:bf_check:1574414039407136789> ForgeScript Code is Valid",
  "summaryText": "No syntax errors or issues detected across 1 line.",
  "issuesText": "",
  "functionsText": "",
  "hasFunctions": false,
  "color": "#57f287",
  "diagnostics": [],
  "functionsDetected": [
    {
      "name": "$sendMessage",
      "package": "forgescript",
      "version": "1.0.0"
    },
    {
      "name": "$channelID",
      "package": "forgescript",
      "version": "1.0.0"
    }
  ],
  "endpoint": "/v1/validate",
  "strict": false,
  "total_issues": 0
}

Was this page helpful?