Expire Market Data Subscription

View as Markdown
### Expire market data subscriptions for users. **Available to:** Organization administrators **Environments:** Live **[Rate Limit](/overview/core-concepts/rate-limits):** No endpoint-specific limit Immediately archive and expire up to 100 market data subscriptions in a single request. Include every subscription in the `marketDataSubscriptionIds` array rather than calling the endpoint once per subscription. The IDs are primary keys from the `marketDataSubscriptions` database table, returned when subscriptions are created with endpoints like [`addMarketDataSubscription`](/api/rest-api-endpoints/users/add-market-data-subscription). Before expiring anything, the endpoint checks that every ID is accessible to your organization. If any ID is inaccessible (because it doesn't exist or belongs to a user outside your organization), the whole request fails and nothing is expired (`errorCode: UsersNotInOrganization`), so validate your IDs before calling. An already-expired but still accessible ID is treated as valid and counted as a success. Partial success (where some IDs expire and others don't) happens only when a backend error interrupts processing after the access check passes (`errorCode: InternalError`). <Warning>A failed request still returns a response body, so don't rely on the absence of an error. Check `ok` along with the `successfulSubscriptionIdExpiries` and `failedSubscriptionIdExpiries` arrays to confirm what was actually expired.</Warning> **Common Failure Scenarios** - One or more IDs don't exist or belong to a user outside your organization. The entire request fails and no subscriptions are expired. - More than 100 IDs are included in a single request. Input validation rejects the request before any subscription is expired. - A backend error interrupts processing. Some IDs may be expired and others not. If you expire a subscription by mistake, create a new one for the user with [`addMarketDataSubscription`](/api/rest-api-endpoints/users/add-market-data-subscription). **Error Messages** | `errorText` | Trigger | |-------------|---------| | `"some marketDataSubscriptions were inaccessible to an admin of this organization"` | One or more IDs don't exist or belong to a user outside your organization (`errorCode: UsersNotInOrganization`). Nothing is expired. | | `"some marketDataSubscriptions failed to be expired"` | A backend error prevented one or more accessible IDs from being expired (`errorCode: InternalError`); check the arrays to see which succeeded. Other backend failures return `InternalError` with a different message, and nothing is expired. | The `errorCode` schema also lists `TooManySubscriptions`, but the endpoint doesn't currently return it. A request with more than 100 IDs is rejected by validation first, with the error `"Market Data Subscription Ids should be no longer than 100"`.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
marketDataSubscriptionIdslist of longsRequired

Response

ExpireMarketDataSubscriptionResponse
okboolean
failedSubscriptionIdExpirieslist of longs
successfulSubscriptionIdExpirieslist of longs
errorTextstringOptional<=8192 characters

Non-empty if the request failed

errorCodeenumOptional
InternalError, TooManySubscriptions, UsersNotInOrganization