Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

API plugins

No security coverage Drupal 10–11
View on drupal.org

The api_plugins module provides a flexible foundation for building API integrations in Drupal. It offers plugin management, request execution, and authentication handling, allowing developers to create reusable connections to external services without extensive custom code for each integration.

Extensible API integration framework for Drupal.

API Plugins provides a shared, plugin-based foundation for connecting Drupal with external APIs. Define endpoint-specific API plugins while reusing consistent request execution, Key module authentication, timeout handling, and error handling.

Features

  • API plugin discovery and management
  • Shared HTTP request, timeout, and error handling
  • Key module based authentication
  • Base classes for creating custom API integrations
  • Provider integrations for OpenAI, Anthropic, MCP, Ollama, and Docker Model Runner
  • Optional API endpoint fields, field mapping, and queued remote-data imports

Requirements

  • Drupal 10 or 11
  • PHP 8.1 or later
  • Key module

Installation

composer require drupal/api_plugins
drush en api_plugins

Enable only the optional submodules you need:

drush en api_plugins_openai
drush en api_plugins_anthropic
drush en api_plugins_mcp
drush en api_plugins_ollama
drush en api_plugins_field_mapping
drush en api_plugins_import_ui

Basic Usage

Call a configured API plugin through the shared request service:

$api_service = \Drupal::service('api_plugins.request');

$result = $api_service->sendRequest('openai_chat_completions', [
  'prompt' => 'What is the capital city of Czechia?',
  'model' => 'gpt-4o-mini',
  'temperature' => 0.0,
]);

Custom API Plugins

Create a plugin in src/Plugin/ApiPlugin/ in your custom module, extending the provided base classes. API Plugins handles plugin discovery, request execution, authentication, and common error handling while your plugin defines its endpoint, payload, headers, and response formatting.

Field Mapping and Imports

The optional Field Mapping submodule provides an api_endpoint field type for storing remote data-source URLs and import settings. It can detect structured data, map source values to entity fields, and queue imports for cron processing. The Import UI submodule adds manual import actions to supported entity edit forms.

Remote endpoint requests are protected against common server-side request forgery risks: non-HTTP(S), loopback, private, link-local, and reserved addresses are rejected, and redirects are disabled.

Provider Integrations

  • OpenAI: Chat Completions and Embeddings
  • Anthropic: Claude Messages API
  • MCP: Model Context Protocol, including Apify MCP
  • Ollama: Local Chat Completions and Embeddings
  • Docker Model Runner: Local OpenAI-compatible chat completions

Security

Store credentials with the Key module, restrict API Plugins administration permissions, and use provider credentials with only the permissions required for the integration. For Field Mapping deployments, retain outbound network controls as an additional protection layer.

Summary

API Plugins is for developers and site builders who need maintainable, reusable API integrations without creating separate request, authentication, and error-handling services for every provider.

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
4
Tracked since
Oct 2025
Latest release
4 days ago
Releases (12 mo)
4 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core Release date
2.0.x-dev Dev 10–11 Aug 27, 2026
2.0.0-rc1 Pre-release 10–11 Aug 27, 2026
1.0.0 Stable 10–11 Jul 9, 2026
1.0.x-dev Dev 10–11 Oct 27, 2025