> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# Create Plugin-Instance

POST https://control-plane.example.com/api/v1/{tenant}/plugin-instances
Content-Type: application/json

Reference: https://docs.fabricgateway.ai/reference/admin-api/plugin-instances/create-plugin-instance

## Authentication

- `fg-tenant-api-key` header (required) — API Key authentication via header

## Request

### Path parameters

- `tenant` (string, required)

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional)
- `plugin_id` (string, optional)
- `scope` (ApiV1TenantPluginInstancesPostRequestBodyContentApplicationJsonSchemaScope, optional)
- `config` (ApiV1TenantPluginInstancesPostRequestBodyContentApplicationJsonSchemaConfig, optional)
- `enabled` (boolean, optional)
- `on_error` (string, optional)

## Response

### 201

201- service-scoped plugin instance

- `name` (string, optional)
- `plugin_id` (string, optional)
- `scope` (ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaScope, optional)
- `when` (ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaWhen, optional)
- `config` (ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaConfig, optional)
- `enabled` (boolean, optional)
- `on_error` (string, optional)

## Errors

### 400 Bad Request Error

400- name is required

- `error` (string, optional)

### 500 Internal Server Error

Server Error

## Types

### ApiV1TenantPluginInstancesPostRequestBodyContentApplicationJsonSchemaScope

- `kind` (string, optional)
- `name` (string, optional)

### ApiV1TenantPluginInstancesPostRequestBodyContentApplicationJsonSchemaConfig

- `limit` (string, optional)

### ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaScope

- `kind` (string, optional)
- `name` (string, optional)

### ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaWhen

### ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaConfig

- `rules` (list of ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaConfigRulesItems, optional)

### ApiV1TenantPluginInstancesPostResponsesContentApplicationJsonSchemaConfigRulesItems

- `service` (string, optional)

## Examples

**Request**

```json
{
  "name": "example-plugin-instance",
  "plugin_id": "example-id",
  "scope": {
    "kind": "example",
    "name": "example-plugin-instance-scope"
  },
  "config": {
    "limit": "1"
  },
  "enabled": true,
  "on_error": "example"
}
```

**Response**

```json
{
  "name": "example-instance",
  "plugin_id": "access-control",
  "scope": {
    "kind": "service",
    "name": "example-service"
  },
  "when": {},
  "config": {
    "rules": [
      {
        "service": "example-service"
      }
    ]
  },
  "enabled": true,
  "on_error": "fail_closed"
}
```

**SDK Code**

```python Plugin instances_createPluginInstance_example
import requests

url = "https://control-plane.example.com/api/v1/acme/plugin-instances"

payload = {
    "name": "example-plugin-instance",
    "plugin_id": "example-id",
    "scope": {
        "kind": "example",
        "name": "example-plugin-instance-scope"
    },
    "config": { "limit": "1" },
    "enabled": True,
    "on_error": "example"
}
headers = {
    "fg-tenant-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Plugin instances_createPluginInstance_example
const url = 'https://control-plane.example.com/api/v1/acme/plugin-instances';
const options = {
  method: 'POST',
  headers: {'fg-tenant-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"example-plugin-instance","plugin_id":"example-id","scope":{"kind":"example","name":"example-plugin-instance-scope"},"config":{"limit":"1"},"enabled":true,"on_error":"example"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Plugin instances_createPluginInstance_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://control-plane.example.com/api/v1/acme/plugin-instances"

	payload := strings.NewReader("{\n  \"name\": \"example-plugin-instance\",\n  \"plugin_id\": \"example-id\",\n  \"scope\": {\n    \"kind\": \"example\",\n    \"name\": \"example-plugin-instance-scope\"\n  },\n  \"config\": {\n    \"limit\": \"1\"\n  },\n  \"enabled\": true,\n  \"on_error\": \"example\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("fg-tenant-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Plugin instances_createPluginInstance_example
require 'uri'
require 'net/http'

url = URI("https://control-plane.example.com/api/v1/acme/plugin-instances")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["fg-tenant-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"example-plugin-instance\",\n  \"plugin_id\": \"example-id\",\n  \"scope\": {\n    \"kind\": \"example\",\n    \"name\": \"example-plugin-instance-scope\"\n  },\n  \"config\": {\n    \"limit\": \"1\"\n  },\n  \"enabled\": true,\n  \"on_error\": \"example\"\n}"

response = http.request(request)
puts response.read_body
```

```java Plugin instances_createPluginInstance_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://control-plane.example.com/api/v1/acme/plugin-instances")
  .header("fg-tenant-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"example-plugin-instance\",\n  \"plugin_id\": \"example-id\",\n  \"scope\": {\n    \"kind\": \"example\",\n    \"name\": \"example-plugin-instance-scope\"\n  },\n  \"config\": {\n    \"limit\": \"1\"\n  },\n  \"enabled\": true,\n  \"on_error\": \"example\"\n}")
  .asString();
```

```php Plugin instances_createPluginInstance_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://control-plane.example.com/api/v1/acme/plugin-instances', [
  'body' => '{
  "name": "example-plugin-instance",
  "plugin_id": "example-id",
  "scope": {
    "kind": "example",
    "name": "example-plugin-instance-scope"
  },
  "config": {
    "limit": "1"
  },
  "enabled": true,
  "on_error": "example"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'fg-tenant-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Plugin instances_createPluginInstance_example
using RestSharp;

var client = new RestClient("https://control-plane.example.com/api/v1/acme/plugin-instances");
var request = new RestRequest(Method.POST);
request.AddHeader("fg-tenant-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"example-plugin-instance\",\n  \"plugin_id\": \"example-id\",\n  \"scope\": {\n    \"kind\": \"example\",\n    \"name\": \"example-plugin-instance-scope\"\n  },\n  \"config\": {\n    \"limit\": \"1\"\n  },\n  \"enabled\": true,\n  \"on_error\": \"example\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Plugin instances_createPluginInstance_example
import Foundation

let headers = [
  "fg-tenant-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "example-plugin-instance",
  "plugin_id": "example-id",
  "scope": [
    "kind": "example",
    "name": "example-plugin-instance-scope"
  ],
  "config": ["limit": "1"],
  "enabled": true,
  "on_error": "example"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://control-plane.example.com/api/v1/acme/plugin-instances")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```