Newly created Agent policy has space_id set to null in version 9.4.2

POST kbn://api/fleet/agent_policies

{

"description": "Private Location Agent Policy",

"monitoring_enabled": [

"logs",

"metrics"

  ],

"name": "Priv Location Agent Policy",

"namespace": "default"

}
{

  "item": {

"id": "532963e5-1c04-4475-b0a3-0d807c6a12e7",

"version": "WzE2OTIyLDY0XQ==",

"created_at": "2026-06-12T19:00:00.169Z",

"description": "Private Location Agent Policy",

"monitoring_enabled": [

"logs",

"metrics"

    ],

"inactivity_timeout": 1209600,

"schema_version": "1.1.1",

"name": "Priv Location Agent Policy",

"namespace": "default",

"status": "active",

"is_managed": false,

"revision": 1,

"updated_at": "2026-06-12T19:00:00.169Z",

"updated_by": "test",

"is_protected": false

  }

}
GET kbn:/api/fleet/agent_policies/532963e5-1c04-4475-b0a3-0d807c6a12e7

{

  "item": {

"id": "532963e5-1c04-4475-b0a3-0d807c6a12e7",

"version": "WzE2OTIyLDY0XQ==",

"created_at": "2026-06-12T19:00:00.169Z",

"space_ids": [],

"description": "Private Location Agent Policy",

"monitoring_enabled": [

"logs",

"metrics"

    ],

"inactivity_timeout": 1209600,

"schema_version": "1.1.1",

"package_policies": [],

"agents": 0,

"name": "Priv Location Agent Policy",

"namespace": "default",

"status": "active",

"is_managed": false,

Are you using Space Aware policies?

If not, this is expected.

Thanks @leandrojmp for your quick response. If I migrate, will it impact existing Agent policies ? If I don't migrate, I am getting error in creating private locations as the space_id is null. Is there a work around in this case ?

I don't think so, but I do not use space aware agent policies, so I do not know how they work.

I think this is unrelated, what you are trying to do and what is the error? I would expect this to work without having space aware agent policies.

I would suggest that you open another topic related to your issue with private locations.