Build the SegmentResponse

  • Respond with a SegmentResponse object within 50 ms containing applicable data segment IDs.

  • Google ignores responses received after the 50 ms deadline.

  • Omit building a SegmentResponse object and respond with an empty HTTP 204 status if no data segments are applicable.

  • Identify relevant segment IDs using the SegmentResponse.segment.segment_id field.

After your curation endpoint processes the signals sent in the segment request, your curation endpoint must build and respond to Google with a SegmentResponse object within 50 ms that identifies data segments that are applicable for each impression. Google ignores responses received after 50 ms.

You can identify the segment IDs relevant for an ad opportunity with the SegmentResponse.segment.segment_id field. You can find the IDs of data segments you created using the dataSegments resource in the Marketplace API. For details, see How to identify data segments in the API versus Real-time Curation.

Respond if no data segments are applicable

If you find that none of your data segments are applicable for a given segment request, omit building a SegmentResponse object and respond with an empty HTTP 204 status.

SegmentResponse example

If the contents of the SegmentRequest object indicate that the impression is relevant to data segments test-data-segment-1 and test-data-segment-2, return their IDs in a SegmentResponse object:

{
  "segment": [
    {
      "segment_id": "test-data-segment-1",
    },
    {
      "segment_id": "test-data-segment-2",
    }
  ]
}