ESG
Entities

Entities ESG Cases Statistics

Get number of active cases by period for one entity.

GET
https://api.textreveal.com/v3/entities/{entity_id}/esg/cases/stats

If a case lasts for several days, it will be counted separately for each day.
This explains the differences in count between month and day aggregations.
A single case that lasts from the first day of the month to the last will be counted as 1 for that month, but will return ~30 results in a aggregation by day.

Request

Parameters

  • entity_id*uuid

    Permanent ID of the entity

    Example: "753c48d6-23c8-5fb0-9230-b099898452b5"
  • sizeinteger

    Number of records per page

    Default: 10Range: [1, 1000]
  • search_afterstring

    search_after field value from the previous page

  • datedate (operator)

    Filters cases whose last_activity is after the minimum bound and whose start_date is before the maximum bound.

    Example: "between:2022-01-01;2022-01-02"
  • date_targetstring (enum)

    Target for date filters. 'case' value filters on the start_date and the last_activity fields of the cases. 'event' value filters on the start_date and the end_date fields of the events.

    Default: "case"Values: "case", "event"
  • periodstring (enum)

    Group results by period.

    Example: with period=week, the result will contain a value per week. If no case occurred during the week, the value will be 0.

    Default: "all"Values: "all", "day", "week", "month", "quarter", "year"
  • return_emptyboolean

    If true, the result will contain a period entry even if no case occurred during the period (with score=0).

  • category(string (enum))[]

    Filter by category.

  • sub_category(string (enum))[]

    Filter by a sub category.

  • contentstring[] | string

    Search for keywords inside the title and summary.

    Note: symbols are ignored in the query, if you use hello@world, the query will be hello world, accentuated letters are preserved.

    Example: word will match WORD, words and any conjugated forms such as wording.

    However, it will not match keyword. To match both terms, you must add each one separately.

    Example: hard drive will return result mentioning hard drives but also hard disk drives, but will not mention document that match drive only. To match those you'll have to search them separately.

Response

Response - 200

Number of active cases by period.

  • data*object[]

    Number of active cases by period in the given range.

  • size*integer

    Number of records per page requested.

    Minimum: 1
  • has_next*boolean

    True if there are more records available.

    Example: true
  • count*integer

    Number of records returned in the current page.

    Minimum: 0
  • search_after*string | null

    Cursor for next page.

Response
{
  "data": [
    {
      "period_start_date": "2025-05-06",
      "period_end_date": "2025-05-13",
      "count": 27,
      "score": {
        "1": 10,
        "2": 4,
        "3": 7,
        "4": 0,
        "5": 6
      }
    }
  ],
  "size": 1,
  "has_next": true,
  "count": 1,
  "search_after": "string"
}

Error

Error - 400

Bad request

  • message*string

    Error message.

    Example: "Check the errors field for more details"
  • code*number

    Error code.

    Example: 400
  • reason*string

    Error reason.

    Example: "invalid"
  • errorsobject[]

    Possible error causes.

Response
{
  "message": "Check the errors field for more details",
  "code": 400,
  "reason": "invalid",
  "errors": [
    {
      "message": "string",
      "field": "size",
      "reason": "invalid_type"
    }
  ]
}

Error - 401

Unauthorized

  • message*string

    Error message.

    Example: "Authorization header is expected"
  • code*number

    Error code.

    Example: 401
  • reason*string

    Error reason.

    Example: "unauthorized"
  • errors*object[]
    Array length: [1, 1]
Response
{
  "message": "Authorization header is expected",
  "code": 401,
  "reason": "unauthorized",
  "errors": [
    {
      "message": "Required",
      "field": "headers.authorization",
      "reason": "invalid_type"
    }
  ]
}

Error - 402

Payment required

  • message*string

    Error message.

    Example: "Your account does not have access to this entity. Contact SESAMm sales for more information."
  • code*number

    Error code.

    Example: 402
  • reason*string

    Error reason.

    Example: "forbidden"
Response
{
  "message": "Your account does not have access to this entity. Contact SESAMm sales for more information.",
  "code": 402,
  "reason": "forbidden"
}

Error - 403

Forbidden

  • message*string

    Error message.

    Example: "Missing required permissions to perform this action."
  • code*number

    Error code.

    Example: 403
  • reason*string

    Error reason.

    Example: "forbidden"
Response
{
  "message": "Missing required permissions to perform this action.",
  "code": 403,
  "reason": "forbidden"
}

Error - 404

Not found

  • message*string

    Error message.

    Example: "The requested entity does not exist or is not visible to your company."
  • code*number

    Error code.

    Example: 404
  • reason*string

    Error reason.

    Example: "not_found"
Response
{
  "message": "The requested entity does not exist or is not visible to your company.",
  "code": 404,
  "reason": "not_found"
}

Error - 405

Method not allowed

  • message*string

    Error message.

    Example: "Method Not Allowed"
  • code*number

    Error code.

    Example: 405
  • reason*string

    Error reason.

    Example: "invalid"
Response
{
  "message": "Method Not Allowed",
  "code": 405,
  "reason": "invalid"
}

Generic errors are not shown, see Errors for more details.