# Batch create plugin-tag relationships

`POST /api/plugin-tags/batch`

Associate multiple tags with a single plugin in one operation. Skips existing relationships.

Authentication: no security requirement declared for this operation.

Request body: application/json (required)

Type: object

Schema: [BulkCreatePluginTagDTO](https://sourcey-gauzy.pages.dev/api-reference/models/bulkcreateplugintagdto/index.md)

- `tenant` (optional)
  Type: object

- `tenantId` (optional)
  Type: string

- `organization` (optional)
  Type: object

- `organizationId` (optional)
  Type: string

- `sentTo` (optional)
  Type: string

- `pluginId` (required)
  Type: string, uuid
  
  Plugin ID to associate with multiple tags
  
  Example:
  
  ```json
  "123e4567-e89b-12d3-a456-426614174000"
  ```

- `tagIds` (required)
  Type: array
  
  Array of tag IDs to associate with the plugin
  
  Example:
  
  ```json
  [
    "456e7890-f12b-34c5-d678-901234567def",
    "abc12345-6789-def0-1234-56789abcdef0"
  ]
  ```
  
  Items:
    Type: string

Responses:

- 201: Successfully created plugin-tag relationships

Content type: application/json

Type: object

- `created` (optional)
  Type: number
  
  Number of relationships created

- `existing` (optional)
  Type: number
  
  Number of relationships that already existed

- `pluginTags` (optional)
  Type: array
  
  Items:
    Reference: [PluginTag](https://sourcey-gauzy.pages.dev/api-reference/models/plugintag/index.md); Type: object

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/plugin-tags/batch' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "pluginId": "123e4567-e89b-12d3-a456-426614174000",
  "tagIds": [
    "456e7890-f12b-34c5-d678-901234567def",
    "abc12345-6789-def0-1234-56789abcdef0"
  ]
}'
```

### JavaScript

```javascript
const body = `{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "pluginId": "123e4567-e89b-12d3-a456-426614174000",
  "tagIds": [
    "456e7890-f12b-34c5-d678-901234567def",
    "abc12345-6789-def0-1234-56789abcdef0"
  ]
}`;

const response = await fetch('http://localhost:3000/api/plugin-tags/batch', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

const data = await response.text();
```

### Python

```python
import requests

body = '''{
  "tenant": {},
  "tenantId": "string",
  "organization": {},
  "organizationId": "string",
  "sentTo": "string",
  "pluginId": "123e4567-e89b-12d3-a456-426614174000",
  "tagIds": [
    "456e7890-f12b-34c5-d678-901234567def",
    "abc12345-6789-def0-1234-56789abcdef0"
  ]
}'''

response = requests.post(
    'http://localhost:3000/api/plugin-tags/batch',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
