---
title: "MIDIEntityAddOrRemoveEndpoints(_:_:_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midientityaddorremoveendpoints(_:_:_:)"
---

# MIDIEntityAddOrRemoveEndpoints(_:_:_:)

Adds or removes an entity’s endpoints.

## Declaration

```swift
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

Return Value An OSStatus result code.

## Discussion

Discussion Drivers and configuration editors may call this function to add to or remove an entity’s endpoints. The MIDIProtocolID of new endpoints is initially the same as that of the entity.

## See Also

### Managing Entities

- [MIDIDeviceNewEntity(_:_:_:_:_:_:_:)](coremidi/mididevicenewentity(_:_:_:_:_:_:_:).md)
- [MIDIDeviceRemoveEntity(_:_:)](coremidi/midideviceremoveentity(_:_:).md)
