---
title: "Segment %alias records with a one-off group"
method: POST
path: "/objects/adHocGroup"
tags: ["objects"]
---

# Segment %alias records with a one-off group

`POST /objects/adHocGroup`

## Request

- Base URL: `https://api.ontraport.com/1`
- URL: `https://api.ontraport.com/1/objects/adHocGroup`
- Auth: none declared

Runs the Group engine (the machinery behind saved segments) on ad-hoc filter rows — the registered POST counterpart of the internal getGroupByFilter flow. filters is a JSON array of legacy group rows {field, operation, value}: operation is one of the engine's op letters (e equals, n not equal, s starts with, z ends with, c contains/has, k does not contain/has not, l less than, g greater than, m at most, h at least, o is empty, x is not empty); a comma inside value is an OR across values. Rows are ANDed. Field must be a plain API-readable object field or a supported named complex field; caller-supplied starred, dotted, and nested saved-group expressions are rejected, and hidden fields cannot be used for filtering or sorting. Explicit tag, sequence, and campaign IDs are scoped to the requested object type. Answers an integer count when count=true; record mode returns API-readable fields with the same deprecated-field removal and PII masking as the standard object API.

## Request body `application/x-www-form-urlencoded`

- object
  - `objectID` integer, required: Object type id of the records being segmented (0 = Contact).
  - `filters` string: JSON array of legacy group filter rows {field, operation, value} (see the endpoint description for the operation letters). Required unless related is given.
  - `related` string: JSON object restricting by related-record presence: {related_object_id, relationship_field, presence: any|none, direction: parent_by_child|child_by_parent, condition}. relationship_field must be a related-record (parent) field linking the two types; condition is a getList-style JSON condition on the related object.
  - `count` boolean: true for an exact count; omit or false for record rows.
  - `range` integer: Record mode: max records per page.
  - `start` integer: Record mode: records to skip (pagination).
  - `sort` string: Record mode: column to sort by.
  - `sortDir` string: Record mode: ASC or DESC.

## Response `200`

Successful segmentation: an integer count, or raw record rows

- Response
  - `code` integer, required
  - `data` object, required
  - `account_id` integer, required

## Other responses

- `400`: Contract violation: missing objectID, malformed or empty filters, unknown operation letter
- `403`: No permissions

## Changes

- **2026-09-30** `c102850cff71`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/ontraport/apis/ontraport-api/changes/objects/adHocGroup/post.md)

---

[API](https://skmtc.dev/ontraport/apis/ontraport-api.md) - [All operations](https://skmtc.dev/ontraport/apis/ontraport-api/llms.txt) - [OpenAPI document](https://skmtc.dev/ontraport/apis/ontraport-api/revisions/4c878a9f93aa?raw)
