Target Groups API

Target Groups cluster Target objects together so they can be referenced as a single unit in Campaign or Number routing settings. Groups can dial their Targets one at a time or simultaneously, enforce concurrency limits, and apply call caps that span the entire group.

Target Group object

Example Target Group:

{
  "target_group": {
    "id": 1,
    "name": "Sales Team",
    "target_ids": [1, 2, 3],
    "targets": [
      { "id": 1, "number": "+18668987878", "name": "Jason Cell", "priority": 1, "weight": 1 },
      { "id": 2, "number": "+18005551234", "name": "Office Line", "priority": 1, "weight": 1 },
      { "id": 3, "number": "+18005555678", "name": "Support Line", "priority": 1, "weight": 1 }
    ],
    "concurrency_cap": null,
    "calls_in_progress": 0,
    "behavior": 1,
    "priority": null,
    "weight": null,
    "caps": [
      { "id": 652978, "filled": 0, "cap": null, "type": "Hard" },
      { "id": 652979, "filled": 0, "cap": null, "type": "Hourly" },
      { "id": 652980, "filled": 0, "cap": null, "type": "Daily" },
      { "id": 652981, "filled": 0, "cap": null, "type": "Monthly" }
    ]
  }
}
Swipe horizontally for full code

Top-level fields

Swipe horizontally to view full table
Field Type Description
id integer Retreaver’s internal ID for the target group.
name string Human-readable label.
target_ids array<integer> IDs of Targets belonging to this group.
targets array The Targets belonging to this group, expanded — see Target.
concurrency_cap integer | null Maximum concurrent calls across all targets in the group. null means unlimited.
calls_in_progress integer Number of calls currently in progress across the group.
behavior integer 1 = Dial separately. 2 = Simuldial (dial all targets simultaneously).
priority integer | null Priority used when the parent dialer is simuldialing groups.
weight integer | null Load-balancing weight used when the parent dialer is simuldialing groups.
caps array Hard, Hourly, Daily, and Monthly caps — see Cap.

Target

Each entry in targets is the full Target object as documented on the Targets API page — all target fields, caps, business hours, tag values, and so on (everything except the target’s own nested target_groups). The example above is abbreviated; the routing-relevant fields are:

Swipe horizontally to view full table
Field Type Description
id integer Retreaver’s internal ID for the target.
number string E.164 phone number or SIP endpoint.
name string | null Descriptive label.
priority integer Lowest value is considered first when routing.
weight integer Randomizes order among targets with equal priority.

Cap

Every Target Group exposes four caps — one of each type. They are created automatically when the group is created.

Swipe horizontally to view full table
Field Type Description
id integer Internal ID of the cap.
type string One of Hard, Hourly, Daily, Monthly.
cap integer | null Limit for this cap. null means no limit.
filled integer Number of calls currently counted toward this cap.

Cap behavior:

  • Hard — permanent. Once reached, the group receives no more calls until manually reset (see Reset hard cap).
  • Hourly / Daily / Monthly — reset automatically on their respective schedules.

List all Target Groups

curl "https://api.retreaver.com/target_groups.json?api_key=[api_key]&company_id=1"
Swipe horizontally for full code

The above command returns an array of Target Group objects.

Returns all Target Groups for the authenticated Company.

HTTP Request

GET https://api.retreaver.com/target_groups.json?api_key=[api_key]&company_id=1

Get a specific Target Group

curl "https://api.retreaver.com/target_groups/1.json?api_key=[api_key]&company_id=1"
Swipe horizontally for full code

The above command returns a single Target Group object.

Returns a Target Group by its Retreaver internal ID.

HTTP Request

GET https://api.retreaver.com/target_groups/{id}.json?api_key=[api_key]&company_id=1

Path Parameters

Swipe horizontally to view full table
Parameter Type Description
id integer Retreaver’s internal ID of the target group.

Create a Target Group

curl -s \
    -X POST \
    "https://api.retreaver.com/target_groups.json?api_key=[api_key]&company_id=1" \
    -H "Content-Type: application/json" \
    -d '{
          "target_group": {
            "name": "Sales Team",
            "target_ids": [1, 2, 3],
            "concurrency_cap": 5
          }
        }'
Swipe horizontally for full code

The above command returns the newly created Target Group object.

Creates a new Target Group. Target Groups can be referenced from Campaign or Number routing and provide shared concurrency and cap enforcement across their member Targets.

HTTP Request

POST https://api.retreaver.com/target_groups.json?api_key=[api_key]&company_id=1

Content-Type: application/json

Body Parameters

All parameters must be nested under a target_group key.

Swipe horizontally to view full table
Parameter Type Default Required Description
name string required Descriptive label for the group.
target_ids array<integer> [] Target IDs to include in the group.
concurrency_cap integer null Maximum concurrent calls across the group. Omit or null for unlimited.
behavior integer 1 1 = Dial separately. 2 = Simuldial (dial all targets simultaneously).
priority integer null if behavior=2 Priority used when simuldialing.
weight integer null if behavior=2 Load-balancing weight used when simuldialing.
hard_cap_attributes object Hard cap — see Cap attributes.
hourly_cap_attributes object Hourly cap — see Cap attributes.
daily_cap_attributes object Daily cap — see Cap attributes.
monthly_cap_attributes object Monthly cap — see Cap attributes.

Cap attributes

Swipe horizontally to view full table
Parameter Type Required Description
cap integer required The cap limit for this period. Set to null to remove.

Tip

Create a simuldial group:

{
  "target_group": {
    "name": "Priority Buyers",
    "target_ids": [1, 2],
    "behavior": 2,
    "priority": 1,
    "weight": 1
  }
}
Swipe horizontally for full code

Update a Target Group

curl -s \
    -X PUT \
    "https://api.retreaver.com/target_groups/1.json?api_key=[api_key]&company_id=1" \
    -H "Content-Type: application/json" \
    -d '{"target_group":{"name":"Renamed Group"}}'
Swipe horizontally for full code

The above command returns the updated Target Group object.

Updates any attributes on the Target Group. Only the fields you pass are changed.

Target membership — three ways to update:

  • target_ids — full replacement list. Replaces all existing members.
  • add_targets_by_id — adds targets without affecting existing members.
  • remove_targets_by_id — removes specific targets from the group.

The add_targets_by_id and remove_targets_by_id helpers avoid having to track the current membership client-side.

HTTP Request

PUT https://api.retreaver.com/target_groups/{id}.json?api_key=[api_key]&company_id=1

Content-Type: application/json

Path Parameters

Swipe horizontally to view full table
Parameter Type Description
id integer Retreaver’s internal ID of the target group.

Body Parameters

Accepts the same parameters as Create a Target Group, plus:

Swipe horizontally to view full table
Parameter Type Description
add_targets_by_id array<integer> Target IDs to add to the group without replacing existing members.
remove_targets_by_id array<integer> Target IDs to remove from the group.

All parameters are optional on update.

Tip

Set a hard cap of 100 calls:

{ "target_group": { "hard_cap_attributes": { "cap": 100 } } }
Swipe horizontally for full code

Delete a Target Group

curl -X DELETE "https://api.retreaver.com/target_groups/1.json?api_key=[api_key]&company_id=1"
Swipe horizontally for full code

Deletes a Target Group. Returns 204 No Content on success.

HTTP Request

DELETE https://api.retreaver.com/target_groups/{id}.json?api_key=[api_key]&company_id=1

Reset hard cap

curl -s \
    -X POST \
    "https://api.retreaver.com/target_groups/1/reset_cap.json?api_key=[api_key]&company_id=1" \
    -H "Content-Type: application/json"
Swipe horizontally for full code

Clears the calls currently counted toward the group’s hard cap and resets the hard cap of every Target in the group to 0. This endpoint requires a superuser account and responds with a 302 redirect (not a 200 OK JSON response).

Useful when reopening a group for a new insertion order period without waiting for the automatic schedule.

HTTP Request

POST https://api.retreaver.com/target_groups/{id}/reset_cap.json?api_key=[api_key]&company_id=1

Help us improve this article or request new support guides.