npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

strapi-plugin-api-select

v1.0.1

Published

A powerful Strapi v5 plugin that provides API-driven select fields with support for GET/POST requests, custom headers, flexible response mapping, and multilingual content.

Downloads

5

Readme

Strapi Plugin API Select

npm version Downloads License: MIT

A powerful Strapi v5 plugin that provides API-driven select fields with support for GET/POST requests, custom headers, flexible response mapping, and multilingual content.

✨ Features

  • 🔗 External API Integration - Fetch select options from any REST API
  • 📡 HTTP Methods - Support for both GET and POST requests
  • 🔐 Authentication - Custom headers and API token support
  • 📋 Request Payloads - Configure JSON payloads for POST requests
  • 🗺️ Flexible Mapping - Handle diverse API response structures
  • 🌐 Proxy Mode - Built-in proxy for private APIs and CORS bypass
  • 🌍 Multilingual - Works with Strapi's i18n features
  • 📱 Selection Modes - Single or multiple selection
  • Performance - Optimized with error handling and caching

🚀 Installation

npm install strapi-plugin-api-select

⚙️ Configuration

Add the plugin to your config/plugins.js file:

module.exports = {
  // ...
  "api-select": {
    enabled: true,
  },
  // ...
};

📖 Usage

1. Add Field to Content Type

  1. Go to Content-Type Builder in your Strapi admin
  2. Select your content type (e.g., Article, Product)
  3. Click Add another field
  4. Choose CustomAPI Select
  5. Configure your field options

2. Field Configuration

Basic Settings

  • Options API URL: The endpoint that returns your options
  • Label Key: Field to use for display text (default: name)
  • Value Key: Field to use for stored value (default: id)
  • Select Mode: Single or Multiple selection
  • Auth Mode: Public API or Proxy for private APIs

Advanced Settings

  • HTTP Method: GET or POST (default: GET)
  • Request Payload: JSON payload for POST requests
  • Custom Headers: Additional headers as JSON object
  • Response Data Path: Path to array in response (e.g., data, results)
  • Response Mapping: Custom field mapping for complex responses

📋 Examples

Basic GET Request

// API URL: https://api.example.com/categories
// Response:
[
  { id: 1, name: "Technology" },
  { id: 2, name: "Science" },
];

// Configuration:
// - Label Key: name
// - Value Key: id

POST Request with Payload

// Configuration:
// - HTTP Method: POST
// - Request Payload:
{
  "filters": {"status": "active"},
  "limit": 100
}

// - Custom Headers:
{
  "Authorization": "Bearer your-token",
  "X-API-Key": "your-api-key"
}

Complex Response Mapping

// API Response:
{
  "success": true,
  "data": {
    "users": [
      {
        "userId": 1,
        "profile": {"displayName": "John Doe"},
        "department": {"name": "Engineering"}
      }
    ]
  }
}

// Configuration:
// - Response Data Path: data.users
// - Response Mapping:
{
  "value": "userId",
  "label": "profile.displayName",
  "group": "department.name"
}

Different Response Formats

The plugin automatically handles various API response structures:

Direct Array

[
  { "id": 1, "name": "Option 1" },
  { "id": 2, "name": "Option 2" }
]

Nested Data

{
  "data": [
    { "id": 1, "title": "Option 1" },
    { "id": 2, "title": "Option 2" }
  ]
}

Complex Structure

{
  "response": {
    "items": [{ "uuid": "abc-123", "label": "Custom Option" }]
  }
}

🔒 Security Features

  • SSRF Protection: Validates API URLs to prevent server-side request forgery
  • Proxy Mode: Routes requests through Strapi backend for private APIs
  • Environment Variables: Support for API tokens via environment variables

Set your API token:

CUSTOM_STRAPI_SELECT_TOKEN=your_api_token_here

🌐 Proxy Mode

For private APIs or to bypass CORS issues, use proxy mode:

  1. Set Auth Mode to "Proxy"
  2. Requests will be routed through your Strapi backend
  3. Configure authentication via environment variables

🎛️ Field Types Supported

Single Selection

Returns a single value:

"selected_option_id";

Multiple Selection

Returns an array of values:

["option_1", "option_2", "option_3"];

🔧 Development

Local Development

  1. Clone the repository
  2. Install dependencies: npm install
  3. Link locally: npm link
  4. In your Strapi project: npm link strapi-plugin-api-select
  5. Restart Strapi

Testing

npm test

📄 API Reference

Server Routes

  • GET /api/api-select/fetch - Proxy endpoint for fetching external API data

Query Parameters

  • api - External API URL
  • labelKey - Field name for option labels
  • valueKey - Field name for option values
  • method - HTTP method (GET/POST)
  • payload - JSON payload for POST requests
  • headers - Custom headers as JSON string

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📝 Changelog

See CHANGELOG.md for a list of changes.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🆘 Support

🙏 Acknowledgments

  • Built for Strapi v5
  • Inspired by the need for dynamic content in headless CMS
  • Thanks to the Strapi community for feedback and contributions

Made with ❤️ for the Strapi community