Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:FlowiseAI Flowise CreateNewAPI

From Leeroopedia
Revision as of 11:14, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/FlowiseAI_Flowise_CreateNewAPI.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Attribute Value
Page Name CreateNewAPI
Workflow Chatbot_Deployment
Repository FlowiseAI/Flowise
Domain Authentication, Security, API Access
Source packages/ui/src/api/apikey.js:L5
Last Updated 2026-02-12 14:00 GMT

Overview

API call implementation for creating a new API key that provides bearer token authentication for programmatic chatflow access.

Code Reference

Source Location

  • File: packages/ui/src/api/apikey.js, line 5
  • UI Components:
    • packages/ui/src/views/apikey/APIKeyDialog.jsx (492 lines) -- dialog for creating/editing keys
    • packages/ui/src/views/apikey/index.jsx (544 lines) -- key management page

Signature

const createNewAPI = (body) => client.post(`/apikey`, body)

Import

import apikeyApi from '@/api/apikey'

The API client is configured at packages/ui/src/api/client.js with base URL ${baseURL}/api/v1.

Related API Functions

The apikey.js module also exports:

const getAllAPIKeys = (params) => client.get('/apikey', { params })
const updateAPI = (id, body) => client.put(`/apikey/${id}`, body)
const deleteAPI = (id) => client.delete(`/apikey/${id}`)

I/O Contract

Inputs

Parameter Type Description
body object Object containing keyName: string
{
  keyName: string  // Human-readable name for the API key (e.g., "Production Backend")
}

Outputs

Field Type Description
data.id string Unique identifier for the API key record
data.keyName string The display name provided at creation
data.apiKey string The bearer token value (shown once at creation)
data.apiSecret string Server-side secret for key validation

Returns Promise<{data: APIKey}>.

Usage Examples

Creating a New API Key

import apikeyApi from '@/api/apikey'

// Create a new API key with a descriptive name
const response = await apikeyApi.createNewAPI({
  keyName: 'Production Backend Service'
})

// response.data contains:
// {
//   id: "abc123",
//   keyName: "Production Backend Service",
//   apiKey: "fl-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
//   apiSecret: "hashed_secret_value"
// }

// Store the apiKey value -- it is only shown once
console.log('API Key:', response.data.apiKey)

Assigning an API Key to a Chatflow

import chatflowsApi from '@/api/chatflows'

// After creating a key, assign it to a chatflow
await chatflowsApi.updateChatflow(chatflowId, {
  apikeyid: apiKeyId
})

Using the API Key in Requests

// Once assigned, the API key is used as a bearer token
const response = await fetch(
  `${baseURL}/api/v1/prediction/${chatflowId}`,
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ question: 'Hello' })
  }
)

Listing All API Keys

import apikeyApi from '@/api/apikey'

const response = await apikeyApi.getAllAPIKeys()
// response.data is an array of APIKey objects (apiKey values are masked)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment