Edit

Add agentInstance to agentCollection

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Important

Upcoming change to Agent Registry APIs

Starting May 2026, the Agent Registry APIs in Microsoft Graph will be replaced by newer Agent Registry APIs powered by Microsoft Agent 365. This change consolidates agent management experiences to make it easier to observe, govern, and secure all agents in your tenant. We recommend that you plan to migrate to the new Agent 365-based APIs when they are released. Learn more about Agent Registry convergence with Microsoft Agent 365.

Add an agentInstance to an agentCollection.To add multiple agentInstance in batch, consider using JSON batching.

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permission Higher privileged permissions
Delegated (work or school account) AgentCollection.ReadWrite.All and AgentInstance.Read.All AgentCollection.ReadWrite.All and AgentInstance.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application AgentCollection.ReadWrite.ManagedBy and AgentInstance.Read.All AgentCollection.ReadWrite.All, AgentCollection.ReadWrite.ManagedBy and AgentInstance.Read.All, AgentCollection.ReadWrite.ManagedBy and AgentInstance.ReadWrite.All, AgentCollection.ReadWrite.ManagedBy and AgentInstance.ReadWrite.ManagedBy

Important

In addition to the permissions listed in the preceding table, the following lesser-privileged permissions scoped to the special collections are supported for this API:

  • For the Global collection: AgentCollection.ReadWrite.Global and AgentInstance.Read.All; AgentCollection.ReadWrite.Global and AgentInstance.ReadWrite.All
  • For the Quarantined collection: AgentCollection.ReadWrite.Quarantined and AgentInstance.Read.All; AgentCollection.ReadWrite.Quarantined and AgentInstance.ReadWrite.All

Important

When using delegated permissions, the authenticated user must be assigned a supported Microsoft Entra role or a custom role that grants the permissions required for this operation.

Agent Registry Administrator is the least privileged role supported for this operation.

HTTP request

POST /agentRegistry/agentInstances/{agentInstanceId}/collections/{agentCollectionId}/members/$ref

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.

Request body

In the request body, supply a JSON object that contains a @odata.id property with a reference by ID to an agentInstance.

Response

If successful, this method returns a 204 No Content response code.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/agentRegistry/agentInstances/{agentInstanceId}/collections/{agentCollectionId}/members/$ref
Content-Type: application/json

{
  "@odata.id": "https://graph.microsoft.com/beta/agentRegistry/agentInstances('agent-instance-id')"
}

Response

The following example shows the response.

HTTP/1.1 204 No Content