Elastic Stack (ELK Stack) Fleet package policies API

Fleet package policies APIs enable you to manage Fleet package policies, including creating, updating, and deleting policies, performing bulk operations, and managing policy upgrades.

Operations 9

GET /api/fleet/package_policies Get package policies #
POST /api/fleet/package_policies Create a package policy #
POST /api/fleet/package_policies/_bulk_get Bulk get package policies #
DELETE /api/fleet/package_policies/{packagePolicyId} Delete a package policy #
GET /api/fleet/package_policies/{packagePolicyId} Get a package policy #
PUT /api/fleet/package_policies/{packagePolicyId} Update a package policy #
POST /api/fleet/package_policies/delete Bulk delete package policies #
POST /api/fleet/package_policies/upgrade Upgrade a package policy #
POST /api/fleet/package_policies/upgrade/dryrun Dry run a package policy upgrade #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/elk-stack-fleet-package-policies-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

elk-stack-fleet-package-policies-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  contact:
    name: Kibana Team
  description: 'The Kibana REST APIs enable you to manage resources such as connectors, data views, and saved objects.

    The API calls are stateless.

    Each request that you make happens in isolation from other calls and must include all of the necessary information for Kibana to fulfill the

    request.

    API requests return JSON output, which is a format that is machine-readable and works well for automation.


    To interact with Kibana APIs, use the following operations:


    - GET: Fetches the information.

    - PATCH: Applies partial modifications to the existing information.

    - POST: Adds new information.

    - PUT: Updates the existing information.

    - DELETE: Removes the information.


    You can prepend any Kibana API endpoint with `kbn:` and run the request in **Dev Tools → Console**.

    For example:


    ```

    GET kbn:/api/data_views

    ```


    For more information about the console, refer to [Run API requests](https://www.elastic.co/docs/explore-analyze/query-filter/tools/console).


    NOTE: Access to internal Kibana API endpoints will be restricted in Kibana version 9.0. Please move any integrations to publicly documented APIs.


    ## Documentation source and versions


    This documentation is derived from the `main` branch of the [kibana](https://github.com/elastic/kibana) repository.

    It is provided under license [Attribution-NonCommercial-NoDerivatives 4.0 International](https://creativecommons.org/licenses/by-nc-nd/4.0/).


    This documentation contains work-in-progress information for future Elastic Stack releases.

    '
  title: Kibana Fleet package policies API
  version: ''
  x-doc-license:
    name: Attribution-NonCommercial-NoDerivatives 4.0 International
    url: https://creativecommons.org/licenses/by-nc-nd/4.0/
  x-feedbackLink:
    label: Feedback
    url: https://github.com/elastic/docs-content/issues/new?assignees=&labels=feedback%2Ccommunity&projects=&template=api-feedback.yaml&title=%5BFeedback%5D%3A+
servers:
- url: https://{kibana_url}
  variables:
    kibana_url:
      default: localhost:5601
security:
- apiKeyAuth: []
- basicAuth: []
tags:
- name: Fleet package policies
  description: 'Fleet package policies APIs enable you to manage Fleet package policies, including creating, updating, and deleting policies, performing bulk operations, and managing policy upgrades.

    '
  x-displayName: Fleet package policies
paths:
  /api/fleet/package_policies:
    get:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies</span></div>


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


        List all package policies.'
      operationId: get-fleet-package-policies
      parameters:
      - description: Page number
        in: query
        name: page
        required: false
        schema:
          type: number
      - description: Number of results per page
        in: query
        name: perPage
        required: false
        schema:
          type: number
      - description: Field to sort results by
        in: query
        name: sortField
        required: false
        schema:
          type: string
      - description: Sort order, ascending or descending
        in: query
        name: sortOrder
        required: false
        schema:
          enum:
          - desc
          - asc
          type: string
      - description: When true, only show policies with available upgrades
        in: query
        name: showUpgradeable
        required: false
        schema:
          type: boolean
      - description: A KQL query string to filter results
        in: query
        name: kuery
        required: false
        schema:
          type: string
      - description: 'Format for the response: simplified or legacy'
        in: query
        name: format
        required: false
        schema:
          enum:
          - simplified
          - legacy
          type: string
      - description: When true, include the agent count per package policy
        in: query
        name: withAgentCount
        required: false
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              examples:
                getPackagePoliciesExample:
                  description: List of package policies
                  value:
                    items:
                    - created_at: '2024-01-15T10:00:00.000Z'
                      enabled: true
                      id: package-policy-id-1
                      inputs: []
                      name: nginx-1
                      namespace: default
                      package:
                        name: nginx
                        title: Nginx
                        version: 1.20.0
                      policy_ids:
                      - agent-policy-id-1
                      updated_at: '2024-01-15T10:00:00.000Z'
                    page: 1
                    perPage: 20
                    total: 1
              schema:
                additionalProperties: false
                type: object
                properties:
                  items:
                    items:
                      $ref: '#/components/schemas/Kibana_HTTP_APIs_package_policy_response'
                    maxItems: 10000
                    type: array
                  page:
                    type: number
                  perPage:
                    type: number
                  total:
                    type: number
                required:
                - items
                - total
                - page
                - perPage
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
      summary: Get package policies
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
    post:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies</span></div>


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


        Create a new package policy and assign it to an agent policy.'
      operationId: post-fleet-package-policies
      parameters:
      - description: A required header to protect against CSRF attacks
        in: header
        name: kbn-xsrf
        required: true
        schema:
          example: 'true'
          type: string
      - description: 'Format for the response: simplified or legacy'
        in: query
        name: format
        required: false
        schema:
          enum:
          - simplified
          - legacy
          type: string
      requestBody:
        content:
          application/json:
            examples:
              postPackagePolicyRequestExample:
                description: Create a new nginx package policy
                value:
                  inputs: {}
                  name: nginx-1
                  namespace: default
                  package:
                    name: nginx
                    version: 1.20.0
                  policy_ids:
                  - agent-policy-id-1
            schema:
              anyOf:
              - $ref: '#/components/schemas/Kibana_HTTP_APIs_create_package_policy_request'
              - $ref: '#/components/schemas/Kibana_HTTP_APIs_simplified_create_package_policy_request'
              description: You should use inputs as an object and not use the deprecated inputs array.
      responses:
        '200':
          content:
            application/json:
              examples:
                postPackagePolicyExample:
                  description: The created package policy
                  value:
                    item:
                      created_at: '2024-01-15T10:00:00.000Z'
                      enabled: true
                      id: package-policy-id-2
                      inputs: []
                      name: nginx-1
                      namespace: default
                      package:
                        name: nginx
                        title: Nginx
                        version: 1.20.0
                      policy_ids:
                      - agent-policy-id-1
                      updated_at: '2024-01-15T10:00:00.000Z'
              schema:
                $ref: '#/components/schemas/Kibana_HTTP_APIs_create_package_policy_response'
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
        '409':
          content:
            application/json:
              examples:
                conflictExample:
                  description: A package policy with the same name already exists
                  value:
                    error: Conflict
                    message: An error message describing what went wrong
                    statusCode: 409
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Conflict
      summary: Create a package policy
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
  /api/fleet/package_policies/_bulk_get:
    post:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies/_bulk_get</span></div>


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


        Get multiple package policies by ID.'
      operationId: post-fleet-package-policies-bulk-get
      parameters:
      - description: A required header to protect against CSRF attacks
        in: header
        name: kbn-xsrf
        required: true
        schema:
          example: 'true'
          type: string
      - description: 'Format for the response: simplified or legacy'
        in: query
        name: format
        required: false
        schema:
          enum:
          - simplified
          - legacy
          type: string
      requestBody:
        content:
          application/json:
            examples:
              postBulkGetPackagePoliciesRequestExample:
                description: Retrieve multiple package policies by ID
                value:
                  ids:
                  - package-policy-id-1
                  - package-policy-id-2
            schema:
              additionalProperties: false
              type: object
              properties:
                ids:
                  description: list of package policy ids
                  items:
                    type: string
                  maxItems: 1000
                  type: array
                ignoreMissing:
                  type: boolean
              required:
              - ids
      responses:
        '200':
          content:
            application/json:
              examples:
                postBulkGetPackagePoliciesExample:
                  description: The requested package policies
                  value:
                    items:
                    - created_at: '2024-01-15T10:00:00.000Z'
                      enabled: true
                      id: package-policy-id-1
                      inputs: []
                      name: nginx-1
                      namespace: default
                      package:
                        name: nginx
                        title: Nginx
                        version: 1.20.0
                      policy_ids:
                      - agent-policy-id-1
                      updated_at: '2024-01-15T10:00:00.000Z'
              schema:
                $ref: '#/components/schemas/Kibana_HTTP_APIs_bulk_get_package_policies_response'
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
        '404':
          content:
            application/json:
              examples:
                notFoundExample:
                  description: One or more package policies were not found
                  value:
                    error: Not Found
                    message: Package policy package-policy-id-2 not found
                    statusCode: 404
              schema:
                additionalProperties: false
                type: object
                properties:
                  message:
                    type: string
                required:
                - message
          description: Not Found
      summary: Bulk get package policies
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
  /api/fleet/package_policies/{packagePolicyId}:
    delete:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb delete">delete</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies/{packagePolicyId}</span></div>


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


        Delete a package policy by ID.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-all AND integrations-all.'
      operationId: delete-fleet-package-policies-packagepolicyid
      parameters:
      - description: A required header to protect against CSRF attacks
        in: header
        name: kbn-xsrf
        required: true
        schema:
          example: 'true'
          type: string
      - description: The ID of the package policy
        in: path
        name: packagePolicyId
        required: true
        schema:
          type: string
      - description: When true, delete the package policy even if it is managed
        in: query
        name: force
        required: false
        schema:
          type: boolean
      responses:
        '200':
          content:
            application/json:
              examples:
                deletePackagePolicyExample:
                  description: The package policy was successfully deleted
                  value:
                    id: package-policy-id-1
              schema:
                $ref: '#/components/schemas/Kibana_HTTP_APIs_delete_one_package_policy_response'
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
      summary: Delete a package policy
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
    get:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb get">get</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies/{packagePolicyId}</span></div>


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


        Get a package policy by ID.'
      operationId: get-fleet-package-policies-packagepolicyid
      parameters:
      - description: The ID of the package policy
        in: path
        name: packagePolicyId
        required: true
        schema:
          type: string
      - description: 'Format for the response: simplified or legacy'
        in: query
        name: format
        required: false
        schema:
          enum:
          - simplified
          - legacy
          type: string
      responses:
        '200':
          content:
            application/json:
              examples:
                getPackagePolicyExample:
                  description: A package policy
                  value:
                    item:
                      created_at: '2024-01-15T10:00:00.000Z'
                      enabled: true
                      id: package-policy-id-1
                      inputs: []
                      name: nginx-1
                      namespace: default
                      package:
                        name: nginx
                        title: Nginx
                        version: 1.20.0
                      policy_ids:
                      - agent-policy-id-1
                      updated_at: '2024-01-15T10:00:00.000Z'
              schema:
                additionalProperties: false
                type: object
                properties:
                  item:
                    $ref: '#/components/schemas/Kibana_HTTP_APIs_package_policy_response'
                required:
                - item
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
        '404':
          content:
            application/json:
              examples:
                notFoundExample:
                  description: No package policy was found with the given ID
                  value:
                    error: Not Found
                    message: Package policy package-policy-id-1 not found
                    statusCode: 404
              schema:
                additionalProperties: false
                type: object
                properties:
                  message:
                    type: string
                required:
                - message
          description: Not Found
      summary: Get a package policy
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
    put:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb put">put</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies/{packagePolicyId}</span></div>


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


        Update a package policy by ID.'
      operationId: put-fleet-package-policies-packagepolicyid
      parameters:
      - description: A required header to protect against CSRF attacks
        in: header
        name: kbn-xsrf
        required: true
        schema:
          example: 'true'
          type: string
      - description: The ID of the package policy
        in: path
        name: packagePolicyId
        required: true
        schema:
          type: string
      - description: 'Format for the response: simplified or legacy'
        in: query
        name: format
        required: false
        schema:
          enum:
          - simplified
          - legacy
          type: string
      requestBody:
        content:
          application/json:
            examples:
              putPackagePolicyRequestExample:
                description: Update a package policy
                value:
                  enabled: true
                  inputs: {}
                  name: nginx-1-updated
                  namespace: default
                  package:
                    name: nginx
                    version: 1.20.0
                  policy_ids:
                  - agent-policy-id-1
            schema:
              anyOf:
              - $ref: '#/components/schemas/Kibana_HTTP_APIs_update_package_policy_request'
              - $ref: '#/components/schemas/Kibana_HTTP_APIs_simplified_create_package_policy_request'
      responses:
        '200':
          content:
            application/json:
              examples:
                putPackagePolicyExample:
                  description: The updated package policy
                  value:
                    item:
                      created_at: '2024-01-15T10:00:00.000Z'
                      enabled: true
                      id: package-policy-id-1
                      inputs: []
                      name: nginx-1-updated
                      namespace: default
                      package:
                        name: nginx
                        title: Nginx
                        version: 1.20.0
                      policy_ids:
                      - agent-policy-id-1
                      updated_at: '2024-01-15T11:00:00.000Z'
              schema:
                additionalProperties: false
                type: object
                properties:
                  item:
                    $ref: '#/components/schemas/Kibana_HTTP_APIs_package_policy_response'
                required:
                - item
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
        '403':
          content:
            application/json:
              examples:
                forbiddenExample:
                  description: The update is not authorized for this package
                  value:
                    error: Forbidden
                    message: An error message describing what went wrong
                    statusCode: 403
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Forbidden
      summary: Update a package policy
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
  /api/fleet/package_policies/delete:
    post:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies/delete</span></div>


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


        Delete multiple package policies by ID.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-all AND integrations-all.'
      operationId: post-fleet-package-policies-delete
      parameters:
      - description: A required header to protect against CSRF attacks
        in: header
        name: kbn-xsrf
        required: true
        schema:
          example: 'true'
          type: string
      requestBody:
        content:
          application/json:
            examples:
              postDeletePackagePoliciesRequestExample:
                description: Delete multiple package policies by ID
                value:
                  packagePolicyIds:
                  - package-policy-id-1
                  - package-policy-id-2
            schema:
              $ref: '#/components/schemas/Kibana_HTTP_APIs_delete_package_policies_request'
      responses:
        '200':
          content:
            application/json:
              examples:
                postDeletePackagePoliciesExample:
                  description: Results of the bulk delete operation
                  value:
                  - id: package-policy-id-1
                    success: true
                  - id: package-policy-id-2
                    success: true
              schema:
                items:
                  $ref: '#/components/schemas/Kibana_HTTP_APIs_delete_package_policies_response_item'
                maxItems: 10000
                type: array
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type: object
                properties:
                  attributes: {}
                  error:
                    type: string
                  errorType:
                    type: string
                  message:
                    type: string
                  statusCode:
                    type: number
                required:
                - message
                - attributes
          description: Bad Request
      summary: Bulk delete package policies
      tags:
      - Fleet package policies
      x-metaTags:
      - content: Kibana
        name: product_name
  /api/fleet/package_policies/upgrade:
    post:
      description: '**Spaces method and path for this operation:**


        <div><span class="operation-verb post">post</span>&nbsp;<span class="operation-path">/s/{space_id}/api/fleet/package_policies/upgrade</span></div>


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


        Upgrade a package policy to a newer package version.<br/><br/>[Required authorization] Route required privileges: fleet-agent-policies-all AND integrations-all.'
      operationId: post-fleet-package-policies-upgrade
      parameters:
      - description: A required header to protect against CSRF attacks
        in: header
        name: kbn-xsrf
        required: true
        schema:
          example: 'true'
          type: string
      requestBody:
        content:
          application/json:
            examples:
              postUpgradePackagePoliciesRequestExample:
                description: Upgrade package policies to the latest version
                value:
                  packagePolicyIds:
                  - package-policy-id-1
            schema:
              $ref: '#/components/schemas/Kibana_HTTP_APIs_upgrade_package_policies_request'
      responses:
        '200':
          content:
            application/json:
              examples:
                postUpgradePackagePoliciesExample:
                  description: Results of the upgrade operation
                  value:
                  - id: package-policy-id-1
                    name: nginx-1
                    success: true
              schema:
                items:
                  $ref: '#/components/schemas/Kibana_HTTP_APIs_package_policy_status_response'
                maxItems: 10000
                type: array
          description: Successful response
        '400':
          content:
            application/json:
              examples:
                genericErrorResponseExample:
                  description: Example of a generic error response
                  value:
                    error: Bad Request
                    message: An error message describing what went wrong
                    statusCode: 400
              schema:
                additionalProperties: false
                description: Generic Error
                type:

# --- truncated at 32 KB (122 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/elk-stack/refs/heads/main/openapi/elk-stack-fleet-package-policies-api-openapi.yml