---
type: api
title: Create a custom integration
description: **Spaces method and path for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-epm-custom-integrations
resource: https://www.elastic.co/elastic/docs-builder/docs/4371/api/doc/kibana/v9/operation/operation-post-fleet-epm-custom-integrations
products:
  - Kibana
---

# Create a custom integration

- Server: `https://{kibana_url}`

## Paths

- `POST` `/api/fleet/epm/custom_integrations`
- `POST` `/s/{space_id}/api/fleet/epm/custom_integrations`

- [Api key auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#apikeyauth)
- [Basic auth](/elastic/docs-builder/docs/4371/api/doc/kibana/v9/authentication#basicauth)

## Description

Refer to [Spaces](https://www.elastic.co/docs/deploy-manage/manage-spaces) for more information.

Create a new custom integration package with user-defined data streams.<br/><br/>[Required authorization] Route required privileges: integrations-all AND fleet-agent-policies-all.

## Request Body

`application/json`

- `datasets` ([] object · max: 10) — required
  - `name` (string) — required
  - `type` (enum) — required
    Values: `logs`, `metrics`, `traces`, `synthetics`, `profiles`
- `force` (boolean) — optional
- `integrationName` (string) — required

## Responses

#### `200`

Successful response

`application/json`

- `_meta` (object)
  - `install_source` (string)
  - `name` (string)
- `items` ([] union anyOf · max: 10000)
  - **Kibana_HTTP_APIs_kibana_asset_reference**
    - `deferred` (boolean)
    - `id` (string)
    - `originId` (string)
    - `type` (union enum | string)
      Values: `dashboard`, `lens`, `visualization`, `search`, `index-pattern`, `map`, `ml-module`, `security-rule`, `csp-rule-template`, `osquery-pack-asset`, `osquery-saved-query`, `tag`
  - **Kibana_HTTP_APIs_es_asset_reference**
    - `customDataStreamOriginDataset` (string)
    - `customDataStreamOriginType` (string)
    - `deferred` (boolean)
    - `id` (string)
    - `type` (enum)
      Values: `index`, `index_template`, `component_template`, `ingest_pipeline`, `ilm_policy`, `data_stream_ilm_policy`, `transform`, `ml_model`, `knowledge_base`, `esql_view`
    - `version` (string)
#### `400`

Bad Request

`application/json`

- `attributes` (object)
- `error` (string)
- `errorType` (string)
- `message` (string)
- `statusCode` (number)
## Code Examples

#### Console

```console
POST /api/fleet/epm/custom_integrations
{
  "datasets": [
    {
      "name": "my_custom_logs.access",
      "type": "logs"
    }
  ],
  "integrationName": "my_custom_logs"
}
```

#### curl

```curl
curl -X POST "https://{kibana_url}/api/fleet/epm/custom_integrations" \
  -H "kbn-xsrf: true" \
  -H "Content-Type: application/json" \
  -d '{
  "datasets": [
    {
      "name": "my_custom_logs.access",
      "type": "logs"
    }
  ],
  "integrationName": "my_custom_logs"
}'
```

## Response Examples

#### Post create custom integration

Custom integration successfully created

```json
{
  "_meta": {
    "install_source": "custom"
  },
  "items": [
    {
      "id": "my_custom_logs-logs-my_custom_logs.access",
      "type": "index_template"
    }
  ]
}
```

#### Generic error response

Example of a generic error response

```json
{
  "error": "Bad Request",
  "message": "An error message describing what went wrong",
  "statusCode": 400
}
```

