See Executions Limit Via API

Describe the problem/error/question

I use to have a workflow that returns the monthly limit of our company, but as we updated to V2.0 it stop working.

What is the error message (if any)?

You don’t have credentials.

1 Like

Hey @jorge-fuentes Welcome to the n8n community!

Can you share your exact workflow? And the type of instance of n8n you are using like self-hosted or Cloud? So that we can try finding the root cause of why that flow does not work in the 2.x versions of n8n

I’m using cloud.

{
“nodes”: [
{
“parameters”: {
“jsCode”: “// Entradas (pueden venir de nodos previos o configurarse manualmente)\nconst monthlyExecutions = Number($input.first().json.executions) || 0;\nconst activeWorkflows = Number($input.first().json.activeWorkflows) || 0;\nconst limit = 2500;\n\n// Cálculo del porcentaje\nconst percentage = (monthlyExecutions / limit) * 100;\n\nlet message = Ahora mismo tenemos ${monthlyExecutions} ejecuciones de ${limit} mensuales con ${activeWorkflows} workflows activos. Eso hace un ${percentage}% del total de este mes.\\n;\n\n// Mensajes según el nivel de uso\nif (percentage >= 100) {\n message += " :police_car_light: ¡Hemos alcanzado el 100% del límite mensual!“\n} else if (percentage > 80) {\n message += " :warning: Estamos acercándonos al límite (80%+).”\n} else if (percentage > 50) {\n message += " :warning: Hemos superado la mitad del limite mensual (50%+).“\n}else {\n message += " :white_check_mark: Estamos por debajo de la mitad del límite.”\n}\n\n// Devolvemos el mensaje\nreturn [{\n message,\n monthlyExecutions,\n activeWorkflows,\n limit,\n percentage: Math.round(percentage)\n}];\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
48,
32
],
“id”: “7263a2b1-27ce-4657-9482-24700bb4e3b7”,
“name”: “Creación del mensaje”
},
{
“parameters”: {
“rule”: {
“interval”: [
{
“field”: “cronExpression”,
“expression”: “1 9 * * 1-5”
}
]
}
},
“type”: “n8n-nodes-base.scheduleTrigger”,
“typeVersion”: 1.2,
“position”: [
-576,
32
],
“id”: “958e9b5f-1d1b-41eb-aba8-30da8af3a83c”,
“name”: “Trigger Diario”
},
{
“parameters”: {
“url”: “n8n.io - Workflow Automation,
“authentication”: “genericCredentialType”,
“genericAuthType”: “httpBearerAuth”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-192,
32
],
“id”: “9f78b2c3-825b-48e1-9f70-e3032b173532”,
“name”: “Get Limits in Workflow”,
“credentials”: {
“httpBearerAuth”: {
“id”: “dZNCW7rgukuH3fER”,
“name”: “N8N Api Key - Jorge”
}
}
}
],
“connections”: {
“Creación del mensaje”: {
“main”: [

]
},
“Trigger Diario”: {
“main”: [
[
{
“node”: “Get Limits in Workflow”,
“type”: “main”,
“index”: 0
}
]
]
},
“Get Limits in Workflow”: {
“main”: [
[
{
“node”: “Creación del mensaje”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “d5cc1f2f073241be559173b68387338fd5a7192103232871476651e424ccec5f”
}
}

1 Like

Hey @jorge-fuentes , i cannot seem to paste this workflow JSON into my n8n instance the root cause is only that this JSON is invalid or maybe not properly sent, can you share your workflow inside the ‘Preformatted Text’ section so that it will showcase as a workflow same as it does in your n8n instance.

1 Like

Hey @jorge-fuentes, i have found some flaws in the CodeNode

1. The Code node returns data in the wrong format

In n8n, a Code node must return an array of items, with each item containing a json property. Currently, you’re returning:

return [{
  message,
  monthlyExecutions,
  activeWorkflows,
  limit,
  percentage: Math.round(percentage)
}];

This should be:

return [{
  json: {
    message,
    monthlyExecutions,
    activeWorkflows,
    limit,
    percentage: Math.round(percentage),
  },
}];

This pattern ensures each item has a json property, as required by n8n’s data structure.


2. The HTTP Request node has no credentials configured

Your current settings:

"authentication": "genericCredentialType",
"genericAuthType": "httpBearerAuth",
"credentials": {}

But credentials is empty, so no token is sent. To fix this:

  • Create an HTTP Request Credential with Bearer Auth, and paste your token there.
  • Select this credential in the HTTP Request node.

Without this, the request to https://homming.app.n8n.cloud/api/v2/limits will fail due to authentication errors.


3. The Schedule Trigger’s cron expression

Your cron:

"cronExpression": "1 9 * * 1-5"

This runs at 09:01 Monday–Friday, which is valid. Just ensure:

  • The workflow is published.
  • Your instance’s timezone matches your expectations; otherwise, times might appear off. You can set the timezone in workflow settings

what i mean is that just:

  • Wrap the returned data in json objects in the Code node.
  • Attach a valid Bearer token credential to the HTTP Request node.
  • Verify your cron expression and timezone settings.

Fixing these points should get your workflow running smoothly.

The problem is the return of the endpoint. In the past i used /api/limits and it returned the executions. The AI make me change the endpoint to api/v2/limits but it returns a data object with this phrase: “We’re sorry but the n8n Editor-UI doesn’t work properly without JavaScript enabled. Please\n\t\t\t\tenable it to continue.”.

I’m not sure if the endpoint is correct.

1 Like

You’re hitting a non‑API URL, which is why you see the HTML “Editor‑UI doesn’t work properly without JavaScript” message.

  • The public API base path is /api/v1, not /api/limits or /api/v2/limits.
  • Calling /api/limits or /api/v2/limits returns the HTML of the editor UI, not JSON, because those aren’t valid API endpoints.
  • The documented endpoints are under /api/v1/, like /api/v1/executions.

What you can do:

  • Use /api/v1/executions to get usage data.
  • The plan’s quota or limits aren’t available via the public API, only in the web dashboard.
  • To build a usage message, combine data from /api/v1/executions with a hard-coded limit set as an environment variable or config, since the limit isn’t accessible via API.

Switch your calls to /api/v1/... endpoints and avoid /api/limits or /api/v2/limits.