> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.zignallabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.zignallabs.com/_mcp/server.

# Query User Alerts

POST https://api.zignallabs.com/detect/v1/alerts
Content-Type: application/json

Queries alerts across specified streams with filtering, pagination, and search.

The authenticated user must have access to the requested streams. Any stream IDs the user does not have access to will be silently excluded.


Reference: https://docs.zignallabs.com/api-reference/data-api-detect/detect/query-detect-alerts

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: zignal-data-api-detect
  version: 1.0.0
paths:
  /detect/v1/alerts:
    post:
      operationId: queryDetectAlerts
      summary: Query User Alerts
      description: >
        Queries alerts across specified streams with filtering, pagination, and
        search.


        The authenticated user must have access to the requested streams. Any
        stream IDs the user does not have access to will be silently excluded.
      tags:
        - detect
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                description: Any type
        '400':
          description: |
            Returned when the request contains invalid parameters:
            - `streams` array is empty or missing
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                streams:
                  type: array
                  items:
                    type: string
                  description: Array of stream IDs to query. At least one required.
                page:
                  type: integer
                  default: 1
                  description: Page number.
                limit:
                  type: integer
                  default: 50
                  description: Results per page.
                sortBy:
                  type: string
                  default: createdAt
                  description: Field to sort by.
                sortDir:
                  $ref: >-
                    #/components/schemas/DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaSortDir
                  default: -1
                  description: Sort direction. -1 for descending, 1 for ascending.
                viewedStatus:
                  $ref: >-
                    #/components/schemas/DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaViewedStatus
                  default: all
                  description: Filter by viewed status.
                text:
                  type: array
                  items:
                    type: string
                  description: Search terms to filter alerts.
                textConditional:
                  $ref: >-
                    #/components/schemas/DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaTextConditional
                  default: or
                  description: Logical operator for text search terms.
                dates:
                  $ref: >-
                    #/components/schemas/DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaDates
                  description: Date range filter.
              required:
                - streams
servers:
  - url: https://api.zignallabs.com
    description: https://api.zignallabs.com
components:
  schemas:
    DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaSortDir:
      type: string
      enum:
        - '-1'
        - '1'
      description: Sort direction. -1 for descending, 1 for ascending.
      title: DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaSortDir
    DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaViewedStatus:
      type: string
      enum:
        - all
        - seen
        - unseen
      default: all
      description: Filter by viewed status.
      title: DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaViewedStatus
    DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaTextConditional:
      type: string
      enum:
        - or
        - and
      default: or
      description: Logical operator for text search terms.
      title: DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaTextConditional
    DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaDates:
      type: object
      properties:
        startDateTime:
          type: string
          format: date-time
        endDateTime:
          type: string
          format: date-time
      description: Date range filter.
      title: DetectV1AlertsPostRequestBodyContentApplicationJsonSchemaDates

```

## Examples



**Request**

```json
{
  "streams": [
    "683a1b2c3d4e5f6a7b8c9d0e"
  ],
  "page": 1,
  "limit": 50,
  "sortBy": "createdAt",
  "sortDir": -1,
  "viewedStatus": "all",
  "dates": {
    "startDateTime": "2026-05-11T00:00:00Z",
    "endDateTime": "2026-05-18T00:00:00Z"
  }
}
```

**SDK Code**

```python Detect_queryDetectAlerts_example
import requests

url = "https://api.zignallabs.com/detect/v1/alerts"

payload = {
    "streams": ["683a1b2c3d4e5f6a7b8c9d0e"],
    "page": 1,
    "limit": 50,
    "sortBy": "createdAt",
    "sortDir": -1,
    "viewedStatus": "all",
    "dates": {
        "startDateTime": "2026-05-11T00:00:00Z",
        "endDateTime": "2026-05-18T00:00:00Z"
    }
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Detect_queryDetectAlerts_example
const url = 'https://api.zignallabs.com/detect/v1/alerts';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"streams":["683a1b2c3d4e5f6a7b8c9d0e"],"page":1,"limit":50,"sortBy":"createdAt","sortDir":-1,"viewedStatus":"all","dates":{"startDateTime":"2026-05-11T00:00:00Z","endDateTime":"2026-05-18T00:00:00Z"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Detect_queryDetectAlerts_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.zignallabs.com/detect/v1/alerts"

	payload := strings.NewReader("{\n  \"streams\": [\n    \"683a1b2c3d4e5f6a7b8c9d0e\"\n  ],\n  \"page\": 1,\n  \"limit\": 50,\n  \"sortBy\": \"createdAt\",\n  \"sortDir\": -1,\n  \"viewedStatus\": \"all\",\n  \"dates\": {\n    \"startDateTime\": \"2026-05-11T00:00:00Z\",\n    \"endDateTime\": \"2026-05-18T00:00:00Z\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Detect_queryDetectAlerts_example
require 'uri'
require 'net/http'

url = URI("https://api.zignallabs.com/detect/v1/alerts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"streams\": [\n    \"683a1b2c3d4e5f6a7b8c9d0e\"\n  ],\n  \"page\": 1,\n  \"limit\": 50,\n  \"sortBy\": \"createdAt\",\n  \"sortDir\": -1,\n  \"viewedStatus\": \"all\",\n  \"dates\": {\n    \"startDateTime\": \"2026-05-11T00:00:00Z\",\n    \"endDateTime\": \"2026-05-18T00:00:00Z\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Detect_queryDetectAlerts_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.zignallabs.com/detect/v1/alerts")
  .header("Content-Type", "application/json")
  .body("{\n  \"streams\": [\n    \"683a1b2c3d4e5f6a7b8c9d0e\"\n  ],\n  \"page\": 1,\n  \"limit\": 50,\n  \"sortBy\": \"createdAt\",\n  \"sortDir\": -1,\n  \"viewedStatus\": \"all\",\n  \"dates\": {\n    \"startDateTime\": \"2026-05-11T00:00:00Z\",\n    \"endDateTime\": \"2026-05-18T00:00:00Z\"\n  }\n}")
  .asString();
```

```php Detect_queryDetectAlerts_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.zignallabs.com/detect/v1/alerts', [
  'body' => '{
  "streams": [
    "683a1b2c3d4e5f6a7b8c9d0e"
  ],
  "page": 1,
  "limit": 50,
  "sortBy": "createdAt",
  "sortDir": -1,
  "viewedStatus": "all",
  "dates": {
    "startDateTime": "2026-05-11T00:00:00Z",
    "endDateTime": "2026-05-18T00:00:00Z"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Detect_queryDetectAlerts_example
using RestSharp;

var client = new RestClient("https://api.zignallabs.com/detect/v1/alerts");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"streams\": [\n    \"683a1b2c3d4e5f6a7b8c9d0e\"\n  ],\n  \"page\": 1,\n  \"limit\": 50,\n  \"sortBy\": \"createdAt\",\n  \"sortDir\": -1,\n  \"viewedStatus\": \"all\",\n  \"dates\": {\n    \"startDateTime\": \"2026-05-11T00:00:00Z\",\n    \"endDateTime\": \"2026-05-18T00:00:00Z\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Detect_queryDetectAlerts_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "streams": ["683a1b2c3d4e5f6a7b8c9d0e"],
  "page": 1,
  "limit": 50,
  "sortBy": "createdAt",
  "sortDir": -1,
  "viewedStatus": "all",
  "dates": [
    "startDateTime": "2026-05-11T00:00:00Z",
    "endDateTime": "2026-05-18T00:00:00Z"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.zignallabs.com/detect/v1/alerts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```