0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Storage → Global Variables

AI-generated

Overview

The 0CodeKit node's "Storage" resource with the "Global Variables" operation provides a set of utilities to manage global variables in your n8n workflows. This includes adding, retrieving, deleting, and listing global variables that can be shared across different executions or workflows.

Common scenarios:

  • Storing configuration values or tokens for use in multiple workflow runs.
  • Sharing state or data between different parts of a workflow.
  • Implementing simple key-value storage for temporary or persistent data.

Practical examples:

  • Save an API token as a global variable and retrieve it in subsequent workflow steps.
  • List all global variables to audit what is currently stored.
  • Delete a global variable when it is no longer needed.

Properties

Name Meaning
Choose a JSON Bin Operation Selects the action to perform on global variables. Options: Add a New Global Variable, Get a Global Variable, Delete a Global Variable, List All Your Global Variables.
Variable Name The name/key of the global variable. Required for "Add a New Global Variable" and "Get a Global Variable".
Variable Value The value to assign to the global variable. Required for "Add a New Global Variable".
Variable ID The unique identifier of the global variable. Required for "Delete a Global Variable". You can obtain this by using the "List All Your Global Variables" operation.

Output

The output structure depends on the selected operation:

  • Add a New Global Variable:
    Returns a JSON object representing the newly created variable, typically including its name, value, and a unique variableId.

  • Get a Global Variable:
    Returns a JSON object with the variable's name and value.

  • Delete a Global Variable:
    Returns a confirmation JSON object, often indicating success or failure of the deletion.

  • List All Your Global Variables:
    Returns an array of JSON objects, each representing a global variable with details such as name, value, and variableId.

Example output for "List All Your Global Variables":

[
  {
    "variableName": "apiToken",
    "variableValue": "12345abcde",
    "variableId": "xyz789"
  },
  {
    "variableName": "userEmail",
    "variableValue": "user@example.com",
    "variableId": "abc123"
  }
]

Dependencies

  • External Service: Requires access to the CodeKit API (as indicated by the required codeKitApi credential).
  • n8n Configuration: You must configure the codeKitApi credential in your n8n instance.

Troubleshooting

Common issues:

  • Missing or invalid credentials: If the codeKitApi credential is not configured or is incorrect, requests will fail.
  • Variable not found: Attempting to get or delete a variable that does not exist will result in an error.
  • Incorrect Variable ID: Deleting requires the correct variableId, which you can obtain via the "list" operation.

Error messages and resolutions:

  • "error: Variable not found": Ensure the variable name or ID is correct and exists.
  • "error: Missing required property": Check that all required fields for the chosen operation are filled.
  • "error: Unauthorized": Verify that your codeKitApi credentials are valid and have sufficient permissions.

Links and References

Discussion