Skip to main content

Generic API Connection

The Generic API connection type enables automations to call any HTTP/REST API endpoint. Rather than tying to a specific service, it provides flexible authentication and request configuration that works with any web service. It is used by the plugin-api plugin, which delegates to the api-connector.

Connection Type​

The Generic API connection does not have a single dedicated ConnectionType enum entry. Instead, the plugin-api reads connection fields directly from the mandatoryFields and advancedFields maps. The authorization model is defined by the Authorization class in the API connector.

PropertyValue
CategoryAPI
Connector classAuthorization (in api-connector)

Authorization Fields​

The API connector supports multiple authentication types, determined by the authType field.

Common Fields​

FieldTypeRequiredDescription
authTypeStringYesAuthentication type. One of: No Auth, Basic Auth, Bearer Token, OAuth 2.0.

No Auth​

No additional fields required. The request is sent without any authentication header.

Basic Auth​

FieldTypeRequiredDescription
usernameStringYesHTTP Basic Authentication username.
passwordStringYesHTTP Basic Authentication password. Encrypted at rest.

The connector encodes username:password in Base64 and sends it as Authorization: Basic <encoded>.

Bearer Token​

FieldTypeRequiredDescription
bearerTokenStringYesThe bearer token value. Encrypted at rest.

Sent as Authorization: Bearer <token>.

OAuth 2.0​

FieldTypeRequiredDescription
grantTypeStringYesOAuth 2.0 grant type: client_credentials or password.
accessTokenGenUrlStringYesToken endpoint URL (e.g., https://auth.example.com/oauth/token).
clientIdStringYesOAuth 2.0 client ID.
clientSecretStringYesOAuth 2.0 client secret. Encrypted at rest.
scopeStringNoSpace-separated list of OAuth scopes to request.
oauthUsernameStringNoResource owner username. Required when grantType is password.
oauthPasswordStringNoResource owner password. Required when grantType is password. Encrypted at rest.
tokenExpiryStringNoToken TTL override in seconds. The connector caches the token until it expires.

Advanced Fields​

FieldTypeRequiredDescription
authorizationNameStringNoName for the authorization configuration (informational).
isAuthEditableBooleanNoWhether the authorization can be modified at the step level during automation design.
addToHeaderBooleanNoWhether to add auth credentials as a request header (default behavior).
addToQueryParamBooleanNoWhether to add auth credentials as a query parameter instead of a header.

Token Lifecycle (OAuth 2.0)​

When using OAuth 2.0, the connector:

  1. Sends a POST request to accessTokenGenUrl with the client credentials and grant type.
  2. Extracts the access_token from the response.
  3. Attaches it as Authorization: Bearer <access_token> on subsequent API calls.
  4. If tokenExpiry is set, the token is cached for that duration. Otherwise, the connector relies on the expires_in field from the token response.

Using the Connection in Automation Steps​

When designing an automation step with the API plugin, you reference the connection by ID. The step configuration also includes:

  • URL: The full request URL or a path that is appended to a base URL.
  • Method: HTTP method (GET, POST, PUT, DELETE, PATCH).
  • Headers: Additional request headers (the auth header is added automatically).
  • Body: Request payload for POST/PUT/PATCH requests.
  • Query Parameters: URL query parameters.

The plugin fetches the connection's decrypted authorization fields at runtime, constructs the appropriate authentication header, and sends the HTTP request through the API connector.

Friendly Example​

What you enterExample
Connection nameVendor API - Order Status
Used forCalling a vendor system to check order or ticket status
Main details to collectBase URL, authentication method, token or client credentials, and timeout
Best person to provide itVendor owner or integration administrator

After it is saved, workflow builders select Vendor API - Order Status in a node instead of entering these details again.

Troubleshooting​

SymptomLikely Cause
401 UnauthorizedWrong credentials, expired token, or incorrect authType
403 ForbiddenCredentials are valid but lack the required permissions/scopes
Connection refused / timeoutTarget API is unreachable, or a firewall/proxy is blocking the request
OAuth token request failsWrong accessTokenGenUrl, clientId, or clientSecret. Verify the token endpoint independently.
SSL certificate problemThe target API uses a self-signed or internal CA certificate not trusted by the platform