API Reference
Complete reference for the NxCreator public API — API key authentication, bot management, and custom webhooks.
The NxCreator public API uses a personal API key for authentication. All endpoints live under the same base URL and accept JSON.
Authentication
Pass your API key as apiKey in the JSON body (POST) or query string (GET). The authenticated user is resolved from the key — no separate uid needed.
An invalid or missing key returns 401 Invalid API Key.
Getting your API key
Your API key is available in the NxCreator dashboard. Open Settings, scroll to the API Key section, and click Copy. The key is generated automatically on first visit and remains stable until you regenerate it.
apiv3 — Bot management
The /apiv3/:path route accepts both GET and POST. Pass apiKey in the body (POST) or query string (GET). The authenticated user is resolved from the key — no separate uid needed.
restartBot
transferBot
Copies the bot and its code to another NxCreator account. Optionally starts the bot immediately on the new account if run_now is true (requires newBotToken). You can also seed initial data into the new bot's collections using dbProps.
| Field | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your API key. |
botId | string | Yes | ID of the bot to transfer. |
targetEmail | string | Yes | Email of the recipient NxCreator account. |
newBotToken | string | No | Bot token for the new bot on the recipient account. |
run_now | boolean | No | Start the new bot immediately. Requires `newBotToken`. |
dbProps | object | No | Initial collection data to seed into the new bot. Keys are collection names (no underscores), values are arrays of documents. |
dbProps must not contain underscores and follow the same rules as regular bot collection names. Each document array is seeded into the corresponding collection on the new bot. Errors per collection are reported individually without blocking the rest of the transfer.editBotCoreLogic
Overwrites the full bot code file. The bot must be restarted separately for changes to take effect.
getbotCode
Custom Webhooks
Every bot can expose HTTP endpoints you define directly in bot code. No API key is required to call them — auth is up to you inside the handler.
Webhook handler contract
Assign an async function to logic['yourPath'] in your bot code:
Response object
Mutate the response object inside your handler to control the HTTP response:
| Field | Type | Description |
|---|---|---|
statusCode | number | HTTP status code. Defaults to 200. The top-level `ok` field is `true` when < 400. |
headers | object | Extra response headers (e.g. `{ "X-Request-Id": "abc" }`). |
message | string | Short human-readable message included in the JSON body. |
data | any | Payload returned under the `data` key. If unset and the handler returns a value, that return value is used automatically. |
| HTTP status | Cause |
|---|---|
| 400 | Invalid path format, or no `logic` handler registered for the requested path. |
| 403 | Bot is under halt — restart it from the dashboard to resume. |
| 404 | Bot ID not found. |
| 500 | Compile or runtime error inside the handler. Full details appear in the bot error log. |
Common use cases
Custom webhooks let any external service trigger bot actions over HTTP. Because they run inside the full bot runtime, you have access to bot.telegram, the db helper, and axios — everything your normal bot code can use.
Push notifications from an external service
Trigger a Telegram message to a user from a payment gateway, CI pipeline, or any backend event.
Broadcast a message to all bot users
Receive third-party webhooks
Use a custom webhook as the callback URL for Stripe, GitHub, or any other service. Validate the payload and store or act on it inside the handler.
Expose bot data as a mini API
Read from your bot's collections and return JSON — useful for a companion web app or dashboard.
Simple token-based auth
Custom webhook routes have no built-in auth. Add your own secret check at the top of any handler that should be private.
process.env.MY_SECRET instead of hardcoding it.