Queries
List Saved Queries
Section titled “List Saved Queries”Returns saved queries that have associated domains. Use this to find queries for inclusion/exclusion in discovery.
GET /queries/savedQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
| max_records | integer | 100 | Maximum records to return (1-1000) |
| offset | integer | 0 | Records to skip for pagination. Must be 0 or greater |
| action | string | none | Filter by action type (e.g. discover, exclusion) |
| tags | array[string] | none | Filter by tags; returns queries matching any of the given tags. Repeat the parameter (tags=a&tags=b) or pass comma-separated (tags=a,b). |
Tag filters are normalized the same way stored tags are (lowercased, spaces become hyphens), so tags=Q2 Outbound matches a stored q2-outbound.
Response
Section titled “Response”{ "results": [ { "query_id": "uuid", "query_name": "My Discovery Query", "action": "discover", "user_name": "John Doe", "mtime": "2026-01-29T12:00:00", "domains": ["company1.com", "company2.com"], "domain_count": 2, "query_params": { ... }, "tags": ["campaign-q1"] } ], "count": 50}Save Query Results
Section titled “Save Query Results”Save a set of result rows as a reusable saved query. This is the REST equivalent of the save-mcp-query MCP tool: it stores a “thin” wrapper (the domains plus any custom columns you send), and the full company data is re-hydrated from your domains when the query is opened in the app.
POST /queries/save-resultsRequest Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
| query_name | string | Yes | Name for the saved query (1-255 characters) |
| action | string | Yes | Underlying action: discover, segment, contacts, append, or match. Stored as thin_<action> |
| data | array[object] | Yes | Result rows. Each row should include a domain (see domain_column); any extra columns are preserved |
| query_params | object | No | Original query params, kept for reconstructing the query in the UI |
| domain_column | string | No | Column holding the domain. Default domain |
| tags | array[string] | No | Tags to attach (max 20 tags, each 2-50 characters) |
curl -X POST "https://api.discolike.com/v1/queries/save-results" \ -H "x-discolike-key: API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query_name": "US fintech shortlist", "action": "discover", "data": [{"domain": "stripe.com", "score": 0.92}, {"domain": "plaid.com", "score": 0.88}], "tags": ["fintech", "outbound-q3"] }'Response
Section titled “Response”{ "query_id": "uuid", "query_name": "US fintech shortlist", "action": "thin_discover", "domain_count": 2, "persona_id_count": 0, "row_count": 2, "tags": ["fintech", "outbound-q3"]}- Domain-based actions (
discover,segment,append,match) require at least one domain acrossdata; onlycontactsaccepts persona-only rows (via apersona_idcolumn). Requests satisfying neither return400. - Values in the domain column must look like domains (e.g.
acme.com); rows with other values make the request return400listing the offending values. persona_idvalues must be integers: fractional numbers, booleans, and strings return400rather than being coerced.- Limits: up to 50,000 rows and 50 MB of serialized payload. Larger requests return
413. To save a larger reusable list of domains or persona IDs, use Create Exclusion List. - Rate limit: 10 requests/minute base, scaled by your plan’s rate-limit multiplier.
- The saved query appears in
GET /queries/savedand can be used withinclusion_query_id/exclusion_query_idin discover and contacts queries.
Create Exclusion List
Section titled “Create Exclusion List”Create a new exclusion list from a list of domains or persona IDs. The list can be used for inclusion/exclusion filtering in discovery and contacts queries.
POST /queries/exclusion-listRequest Body
Section titled “Request Body”Domain list example:
{ "query_name": "My Exclusion List", "domains": ["competitor1.com", "competitor2.com", "competitor3.com"], "tags": ["competitors", "scheduled-removal"]}Persona ID list example (from contacts search results):
curl -X POST "https://api.discolike.com/v1/queries/exclusion-list" \ -H "x-discolike-key: API_KEY" \ -H "Content-Type: application/json" \ -d '{"query_name": "Contacted VPs", "persona_ids": [12345678, 87654321]}'| Field | Type | Required | Description |
|---|---|---|---|
| query_name | string | Yes | Name for the exclusion list (1-255 characters) |
| domains | array[string] | No | List of domains to save. Provide domains, persona_ids, or both. |
| persona_ids | array[integer] | No | Array of persona IDs to save (from contacts search results). Provide domains, persona_ids, or both. |
| tags | array[string] | No | Tags to apply at creation (max 20 tags, each 2-50 characters). Tags are sanitized: lowercased, spaces become hyphens, invalid characters removed. The response echoes the stored form. |
Response
Section titled “Response”{ "query_id": "uuid", "query_name": "My Exclusion List", "domain_count": 3, "tags": ["competitors", "scheduled-removal"]}- Minimum of 20 domains for domain lists (persona-only lists are exempt). Smaller domain lists return
400. - Maximum of 250,000 domains or 500,000 persona IDs per exclusion list (lists exceeding this limit are automatically truncated). The same caps apply when a list is used for exclusion; an over-cap list returns
400. - Duplicate domains and persona IDs are automatically removed
- At least one of
domainsorpersona_idsmust be provided - Lists created from contacts search results store persona IDs. Lists created from discover or other endpoints store domains. Both types appear in the same saved queries listing and can be used with
exclusion_query_idorinclusion_query_idparameters. - The created query has
action: "exclusion" - Use the returned
query_idin theinclusion_query_idorexclusion_query_idparameters of the discover or contacts endpoints
Update Query
Section titled “Update Query”Update the name and/or tags of a saved query. You can update just the name, just the tags, or both in a single request.
PATCH /queries/{query_id}Request Body
Section titled “Request Body”{ "query_name": "New Query Name", "tags": ["campaign-q1", "enterprise"]}| Field | Type | Required | Description |
|---|---|---|---|
| query_name | string | No | New name for the query |
| tags | array[string] | No | New list of tags (replaces existing) |
At least one field must be provided.
Response
Section titled “Response”{ "query_id": "uuid", "query_name": "New Query Name", "tags": ["campaign-q1", "enterprise"]}Delete Query
Section titled “Delete Query”Delete a saved query (including exclusion lists) by ID. You can only delete queries owned by your account.
DELETE /queries/{query_id}Response
Section titled “Response”{ "message": "Query deleted successfully"}Returns 404 if no query with that ID exists under your client domain.