> ## Documentation Index
> Fetch the complete documentation index at: https://chainpatrol.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Obtener amenazas bloqueadas por origen del primer reporte

> Count distinct currently blocked assets whose earliest report for the organization falls in the date range, split into customer vs ChainPatrol (staff + automation). Blocked is current status or pending BLOCKED, not blockedAt. This does not equal /metrics/found.

## Descripción general

Cuenta los **assets** (activos digitales: URL, dirección, perfil, app, etc.) distintos que están actualmente bloqueados y cuyo primer reporte para tu organización
cae dentro de un rango de fechas, separados según quién los reportó primero: tu equipo (`customer`) o
ChainPatrol (`chainpatrol`). Usa este endpoint para ver cuántas amenazas bloqueadas fueron
descubiertas de forma proactiva por ChainPatrol y cuántas fueron enviadas por tu propio equipo y tu comunidad.

> [!NOTE]
>
> Este endpoint está restringido por el feature flag `threat-discovery-source-api`, que se
> habilita por organización. Si el flag no está habilitado para tu organización, la API
> devuelve un error 403 Forbidden. Contacta a ChainPatrol para habilitar el acceso.

## Cómo se cuentan los assets

* **Cohorte del primer reporte** — Cada asset se atribuye al origen de su primer
  reporte no eliminado para tu organización. El rango de fechas filtra según cuándo se creó ese primer
  reporte, no según cuándo se bloqueó el asset.
* **Solo bloqueados** — Solo se cuentan los assets cuyo estado actual (o estado pendiente) es `BLOCKED`.
  Los assets que se reportaron dentro del rango pero nunca se bloquearon, o que luego
  se desbloquearon, quedan excluidos.
* **Categorías de origen**:
  * `customer` — assets reportados primero por tu equipo, por un reportante externo o por un
    usuario con rol de cliente.
  * `chainpatrol` — assets reportados primero por el personal de ChainPatrol o por la automatización. El personal
    y la automatización se agrupan en una sola categoría.
  * `totals` — `customer` + `chainpatrol`.

> [!WARNING]
>
> `totals.blocked` no coincide con los conteos de [`POST
>     /metrics/found`](https://chainpatrol.com/docs/es/external-api/metrics-found.md). Este endpoint aplica el rango sobre la fecha del
> primer reporte de cada asset, mientras que `/metrics/found` cuenta los assets según cuándo se bloquearon.

## Manejo de fechas

* `startDate` y `endDate` son obligatorios, y `startDate` debe ser igual o anterior a
  `endDate`.
* Los valores de solo fecha (`YYYY-MM-DD`) se interpretan en UTC. `startDate` empieza a la
  medianoche UTC y `endDate` abarca todo el día (hasta las 23:59:59.999 UTC). Envía una
  marca de tiempo ISO 8601 completa si necesitas un corte preciso.
* Las fechas de calendario imposibles (por ejemplo, `2026-02-31`) se rechazan con un error 400
  en lugar de trasladarse al mes siguiente.

## Filtrado por marca

Envía el arreglo opcional `brandIds` para limitar los conteos a los assets que pertenecen a marcas
específicas. Todos los ID deben pertenecer a tu organización. Si algún ID hace referencia a una marca ajena
a tu organización (o a una marca eliminada), la API devuelve un error 404 en lugar de ignorarlo
silenciosamente.

## Ejemplo de solicitud

```bash theme={null}
curl --request POST \
  --url https://app.chainpatrol.io/api/v2/metrics/found-by-source \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '{
    "slug": "your-org-slug",
    "startDate": "2026-07-01",
    "endDate": "2026-07-31",
    "brandIds": [123]
  }'
```

## Ejemplo de respuesta

```json theme={null}
{
  "range": {
    "startDate": "2026-07-01T00:00:00.000Z",
    "endDate": "2026-07-31T23:59:59.999Z"
  },
  "customer": {
    "blocked": 42
  },
  "chainpatrol": {
    "blocked": 137
  },
  "totals": {
    "blocked": 179
  }
}
```


## OpenAPI

````yaml POST /metrics/found-by-source
openapi: 3.0.3
info:
  title: ChainPatrol External API - OpenAPI 3.0
  description: ChainPatrol External API documentation
  version: 2.0.0
servers:
  - url: https://app.chainpatrol.io/api/v2
security: []
tags:
  - name: asset
  - name: report
  - name: dark-web
externalDocs:
  url: https://chainpatrol.com/docs
paths:
  /metrics/found-by-source:
    post:
      tags:
        - metrics
      summary: Get currently blocked threats by first-report source
      description: >-
        Count distinct currently blocked assets whose earliest report for the
        organization falls in the date range, split into customer vs ChainPatrol
        (staff + automation). Blocked is current status or pending BLOCKED, not
        blockedAt. This does not equal /metrics/found.
      operationId: metricsFoundBySource
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                slug:
                  type: string
                  minLength: 1
                  description: Organization slug
                startDate:
                  type: string
                  description: >-
                    Only include assets whose earliest report was created on or
                    after this date. A date-only value (YYYY-MM-DD) starts at
                    midnight UTC
                endDate:
                  type: string
                  description: >-
                    Only include assets whose earliest report was created on or
                    before this date. A date-only value (YYYY-MM-DD) covers the
                    whole day in UTC; pass a full timestamp for a precise
                    cut-off
                brandIds:
                  type: array
                  items:
                    type: integer
                    minimum: 0
                    exclusiveMinimum: true
                  description: Only include assets belonging to these brands
              required:
                - slug
                - startDate
                - endDate
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  range:
                    type: object
                    properties:
                      startDate:
                        type: string
                      endDate:
                        type: string
                    required:
                      - startDate
                      - endDate
                  customer:
                    type: object
                    properties:
                      blocked:
                        type: integer
                        minimum: 0
                        description: >-
                          Distinct assets whose earliest report for this org
                          falls in the range and whose current status or pending
                          status is BLOCKED
                    required:
                      - blocked
                    description: >-
                      Currently blocked assets first reported by the customer
                      (reportedByCustomer, external reporter, or customer-role
                      user)
                  chainpatrol:
                    type: object
                    properties:
                      blocked:
                        type: integer
                        minimum: 0
                        description: >-
                          Distinct assets whose earliest report for this org
                          falls in the range and whose current status or pending
                          status is BLOCKED
                    required:
                      - blocked
                    description: >-
                      Currently blocked assets first reported by ChainPatrol
                      staff or automation. Staff and automation are collapsed
                      together.
                  totals:
                    type: object
                    properties:
                      blocked:
                        type: integer
                        minimum: 0
                        description: >-
                          Distinct assets whose earliest report for this org
                          falls in the range and whose current status or pending
                          status is BLOCKED
                    required:
                      - blocked
                    description: >-
                      customer + chainpatrol. This is a first-report blocked
                      cohort and does not equal metrics/found, which counts
                      assets by blockedAt.
                required:
                  - range
                  - customer
                  - chainpatrol
                  - totals
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '401':
          description: Authorization not provided
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.UNAUTHORIZED'
        '403':
          description: Insufficient access
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.FORBIDDEN'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
      security:
        - ApiKey: []
components:
  schemas:
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Invalid input data error (400)
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.UNAUTHORIZED:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Authorization not provided
        code:
          type: string
          description: The error code
          example: UNAUTHORIZED
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Authorization not provided error (401)
      description: The error information
      example:
        code: UNAUTHORIZED
        message: Authorization not provided
        issues: []
    error.FORBIDDEN:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Insufficient access
        code:
          type: string
          description: The error code
          example: FORBIDDEN
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Insufficient access error (403)
      description: The error information
      example:
        code: FORBIDDEN
        message: Insufficient access
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Internal server error error (500)
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-KEY
      description: >-
        Your API key. This is required by most endpoints to access our API
        programatically. Reach out to us at
        [support@chainpatrol.io](mailto:support@chainpatrol.io?subject=Re:%20API%20Key%20for%20SDK&body=Company:%20%0AName:%20%0APurpose:%20)
        to get an API key for your use.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.