<!--
{
  "availability" : [
    "iOS: 4.2.0 -",
    "iPadOS: 4.2.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMIDI",
  "identifier" : "/documentation/CoreMIDI/MIDIEntityAddOrRemoveEndpoints(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core MIDI"
    ],
    "preciseIdentifier" : "c:@F@MIDIEntityAddOrRemoveEndpoints"
  },
  "title" : "MIDIEntityAddOrRemoveEndpoints(_:_:_:)"
}
-->

# MIDIEntityAddOrRemoveEndpoints(_:_:_:)

Adds or removes an entity’s endpoints.

```
func MIDIEntityAddOrRemoveEndpoints(_ entity: MIDIEntityRef, _ numSourceEndpoints: Int, _ numDestinationEndpoints: Int) -> OSStatus
```

## Parameters

`entity`

The entity to update.

`numSourceEndpoints`

The number of source endpoints.

`numDestinationEndpoints`

The number of destination endpoints.

## Return Value

An `OSStatus` result code.

## Discussion

Drivers and configuration editors may call this function to add to or remove an entity’s endpoints. The [`MIDIProtocolID`](/documentation/CoreMIDI/MIDIProtocolID) of new endpoints is initially the same as that of the entity.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)