How to hide 'Custom API Call' option in a custom node?

Describe the problem/error/question

I’m building a custom node for Airtop and I would like to hide the “Custom API Call” option that is listed in the node operations as shown in the image below:

Credentials

import type {
	IAuthenticateGeneric,
	ICredentialType,
	ICredentialTestRequest,
	INodeProperties,
} from 'n8n-workflow';

export class AirtopApi implements ICredentialType {
	name = 'airtopApi';

	displayName = 'Airtop API';

	documentationUrl = 'airtop';

	properties: INodeProperties[] = [
		{
			displayName: 'API Key',
			name: 'apiKey',
			type: 'string',
			default: '',
			required: true,
			typeOptions: {
				password: true,
			},
			noDataExpression: true,
		},
	];

	authenticate: IAuthenticateGeneric = {
		type: 'generic',
		properties: {
			headers: {
				Authorization: '=Bearer {{$credentials.apiKey}}',
				'api-key': '={{$credentials.apiKey}}',
			},
		},
	};

	test: ICredentialTestRequest = {
		request: {
			method: 'GET',
			baseURL: 'https://api.airtop.ai/api/v1',
			url: '/sessions',
			qs: {
				limit: 10,
			},
		},
	};
}

Information on your n8n setup

  • **n8n version:**1.81.0
  • **Database (default: SQLite):**Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):**Docker
  • **Operating system:**MacOS

Searching throughout the code, you have to either make your node’s defaultVersion mismatch the node’s version.

My node description

export class Airtop implements INodeType {
   description: INodeTypeDescription = {
   ...
   defaultVersion: 1,
   version: [1], // array !== number
    ...
  }
}

packages/cli/src/load-nodes-and-credentials.ts

private injectCustomApiCallOptions() {
    this.types.nodes.forEach((node: INodeTypeDescription) => {

    // Make sure this returns false	
    const isLatestVersion =
				node.defaultVersion === undefined || node.defaultVersion === node.version;

    if (isLatestVersion) {
        if (!this.supportsProxyAuth(node)) return;

				node.properties.forEach((p) => {
					if (
						['resource', 'operation'].includes(p.name) &&
						Array.isArray(p.options) &&
						p.options[p.options.length - 1].name !== CUSTOM_API_CALL_NAME
					) {
						p.options.push({
							name: CUSTOM_API_CALL_NAME,
							value: CUSTOM_API_CALL_KEY,
						});
					}
				});
			}
		});
	}
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.