Overview
The Segments Add Members endpoint populates a segment with people identified by their Minerva PIDs. This is the primary method for building segment membership after creating a segment. How It Works:- Provide a
segment_id(from the create endpoint) and an array ofminerva_pids(from resolve/enrich calls) - The API validates each PID against the Minerva database
- New members are added; existing members are tracked but not duplicated
- The segment’s
current_sizeis automatically updated - Membership timestamps (
first_added_at,last_added_at) are maintained for each person
first_added_at timestamp for historical tracking.
Request
Headers
Your API key for authentication
application/json
Request Body
The request body must be a JSON object containing:The UUID of the target segment (obtained from the segments/create endpoint). The segment must exist and belong to your organization.
Array of Minerva person identifiers (strings) to add to the segment. PIDs are obtained from the resolve or enrich endpoints and follow the format “p-”. There is no strict upper limit on array size, but keep requests reasonable for performance (batches of 1,000-10,000 are typical).
Request Example
Response
Success Response
The API returns a detailed breakdown of the operation, reporting successes, duplicates, and invalid PIDs.Unique identifier for this API request, useful for debugging and support
Detailed results object containing operation statistics and invalid PIDs
ISO 8601 timestamp (YYYY-MM-DDTHH:MM:SS.ffffffZ format) when the operation completed
Results Object Structure
Array of Minerva PID strings that were not found in the Minerva database. These PIDs were rejected and not added to the segment. This typically indicates PIDs that don’t exist, were incorrectly formatted, or came from a different data source.
Count of PIDs that were already members of this segment. These PIDs were not added again (segments maintain unique membership), but their
last_added_at timestamp was updated to reflect the re-addition attempt.Count of PIDs successfully added to the segment as new members. These are PIDs that were valid and not previously in the segment.
The total number of unique members in the segment after this operation completes. This reflects the segment’s size including all historical members, not just those added in this request.
- 3 PIDs submitted in the request
- 1 PID invalid (
p-invalid123not found in database) - 1 PID redundant (already in the segment,
last_added_atupdated) - 2 PIDs added (new members successfully added)
- 1,523 total members now in the segment (including these 2 new additions)
Error Responses
The API returns standard HTTP status codes with descriptive error messages:401- Unauthorized: Invalid or missing API key in x-api-key header404- Not Found: Segment with the providedsegment_iddoes not exist in your organization OR attempting to use v1 API version (only v2 supported)405- Method Not Allowed: Using GET, PUT, DELETE, or other methods (only POST supported)422- Unprocessable Entity: Request body is not valid JSON, missing required fields (segment_idorminerva_pids), orminerva_pidsis not an array500- Internal Server Error: Unexpected server error occurred
Error Examples
Segment not found:Implementation Notes
- API Version: Only v2 is supported. Using
/v1/segments/members/addreturns a 404 error. - HTTP Method: Only POST requests are accepted.
- Partial Success: Invalid PIDs are reported in
invalid_minerva_pidsbut don’t cause the entire operation to fail. Valid PIDs are still added. - Idempotency: Adding a PID already in the segment is safe and not an error. It increments
n_redundant_additionsand updateslast_added_at, but doesn’t create a duplicate entry. - Atomicity: The operation is atomic for valid PIDs - either all are added successfully, or none are (in case of database errors).
- Batch Size: There’s no hard limit on array size, but for optimal performance keep batches between 1,000-10,000 PIDs.
- Validation: Each PID is validated against the Minerva database (
person_core_v1table). PIDs not found in the database are returned as invalid. - Timestamps: The system maintains both
first_added_at(initial addition) andlast_added_at(most recent addition) for each member.
Performance Considerations
- Throughput: The endpoint can handle large batches efficiently due to bulk SQL operations
- Response Time: Expect ~100-500ms for batches of 1,000 PIDs, scaling roughly linearly
- Rate Limiting: Standard API rate limits apply (contact support for details)
- Concurrent Requests: Multiple concurrent add operations to the same segment are safe; the database handles concurrency
Related Endpoints
- Create Segment - Create the segment before adding members
- Get Segment Members - Retrieve current members
- Remove Members - Remove specific members
- Resolve API - Get Minerva PIDs for people to add

