time-entries

Search time entries

POST /v1/time-entries/search

Default page size 100, maximum 500. Keep filters and pass nextCursor to continue. Data can change during pagination; use full export for a backup.

Request body

Required

application/json

Type: object

FieldTypeRequiredDescription and constraints
fromDatestringNoInclusive filter start date {"format":"date"}
toDateExclusivestringNoExclusive filter end date {"format":"date"}
fromstringNoInclusive start timestamp; provide with to {"format":"date-time"}
tostringNoExclusive end timestamp; provide with from {"format":"date-time"}
statestringNoEntry, job or operation state; meaning depends on the endpoint {"enum":["running","stopped","invalid"]}
projectIdsarray<string>NoProject IDs; comma-separated in GET, array in POST {"minItems":1,"maxItems":100}
projectIds[]stringNo{"minLength":1,"maxLength":512}
tagIdsarray<string>NoTag IDs; comma-separated GET filter, array in bodies {"minItems":1,"maxItems":100}
tagIds[]stringNo{"minLength":1,"maxLength":512}
tagMatchstringNoTag matching: any or all {"enum":["any","all"]}
noProjectbooleanNoMatch entries without a project
noTagsbooleanNoMatch entries without tags
includeDescendantsbooleanNoInclude descendant tags when filtering
archivedstringNoArchive filter: active, only or all {"enum":["active","only","all"]}
matchstringNoTime matching: overlaps or startsWithin {"enum":["overlaps","startsWithin"]}
textstringNoSearch text; POST avoids putting it in URLs {"maxLength":500}
limitintegerNoPage size; default 100, maximum 500 {"minimum":1,"maximum":500}
cursorstringNoOpaque cursor; return unchanged, do not parse {"maxLength":8192}
Complete JSON Schema
{
  "type": "object",
  "properties": {
    "fromDate": {
      "type": "string",
      "format": "date",
      "description": "Inclusive filter start date"
    },
    "toDateExclusive": {
      "type": "string",
      "format": "date",
      "description": "Exclusive filter end date"
    },
    "from": {
      "type": "string",
      "format": "date-time",
      "description": "Inclusive start timestamp; provide with to"
    },
    "to": {
      "type": "string",
      "format": "date-time",
      "description": "Exclusive end timestamp; provide with from"
    },
    "state": {
      "type": "string",
      "enum": [
        "running",
        "stopped",
        "invalid"
      ],
      "description": "Entry, job or operation state; meaning depends on the endpoint"
    },
    "projectIds": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512
      },
      "minItems": 1,
      "maxItems": 100,
      "description": "Project IDs; comma-separated in GET, array in POST"
    },
    "tagIds": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 512
      },
      "minItems": 1,
      "maxItems": 100,
      "description": "Tag IDs; comma-separated GET filter, array in bodies"
    },
    "tagMatch": {
      "type": "string",
      "enum": [
        "any",
        "all"
      ],
      "description": "Tag matching: any or all"
    },
    "noProject": {
      "type": "boolean",
      "description": "Match entries without a project"
    },
    "noTags": {
      "type": "boolean",
      "description": "Match entries without tags"
    },
    "includeDescendants": {
      "type": "boolean",
      "description": "Include descendant tags when filtering"
    },
    "archived": {
      "type": "string",
      "enum": [
        "active",
        "only",
        "all"
      ],
      "description": "Archive filter: active, only or all"
    },
    "match": {
      "type": "string",
      "enum": [
        "overlaps",
        "startsWithin"
      ],
      "description": "Time matching: overlaps or startsWithin"
    },
    "text": {
      "type": "string",
      "maxLength": 500,
      "description": "Search text; POST avoids putting it in URLs"
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 500,
      "description": "Page size; default 100, maximum 500"
    },
    "cursor": {
      "type": "string",
      "maxLength": 8192,
      "description": "Opaque cursor; return unchanged, do not parse"
    }
  },
  "additionalProperties": false
}

Request example

Replace path and request parameters with actual values. For requests with a body, save it as request.json using the schema above.

curl --fail-with-body --request POST 'https://api.treering.cn/v1/time-entries/search' \
  --header "Authorization: Bearer $TREERING_API_TOKEN" \
  --header 'Content-Type: application/json' \
  --data-binary @request.json

Responses

200

Successful response; status depends on the operation result.

application/json

Type: object

FieldTypeRequiredDescription and constraints
itemsarray<object>YesResources, events or operation results
items[]objectNo{"additionalProperties":false}
items[].idstringYesResource, job or operation identifier
items[].versionstringYesVersion as a decimal string; do not convert to a floating-point number {"pattern":"^(0|[1-9][0-9]*)$"}
items[].etagstringYesConcurrency tag; preserve quotes when sending If-Match
items[].updatedAtstringYesLast server update timestamp
items[].operationIdstringNoRequest receipt identifier; no status polling is needed
items[].deletedAtstringNoDeletion timestamp
items[].startTimestring | nullNoStart timestamp in ISO 8601 with a time zone
items[].startTime (anyOf 1)stringNo
items[].startTime (anyOf 2)nullNo
items[].stopTimestring | nullNoStop timestamp; null means running
items[].stopTime (anyOf 1)stringNo
items[].stopTime (anyOf 2)nullNo
items[].detailstring | nullNoEntry description
items[].detail (anyOf 1)stringNo
items[].detail (anyOf 2)nullNo
items[].notestring | nullNoNote
items[].note (anyOf 1)stringNo
items[].note (anyOf 2)nullNo
items[].projectIdstring | nullNoProject ID, or null
items[].projectId (anyOf 1)stringNo
items[].projectId (anyOf 2)nullNo
items[].tagIdsarray<string>NoTag IDs; comma-separated GET filter, array in bodies
items[].tagIds[]stringNo
items[].sourcestring | nullNoSource label
items[].source (anyOf 1)stringNo
items[].source (anyOf 2)nullNo
items[].statestringNoEntry, job or operation state; meaning depends on the endpoint
items[].durationSecondsnumber | nullNoDuration in seconds; may be fractional
items[].durationSeconds (anyOf 1)numberNo
items[].durationSeconds (anyOf 2)nullNo
hasMorebooleanYesWhether another page is available
nextCursorstring | nullYesNext-page cursor, or null on the final page
nextCursor (anyOf 1)stringNo
nextCursor (anyOf 2)nullNo
evaluatedAtstringYesServer evaluation timestamp
effectiveRangeobject | nullYesFixed effective range for this query
effectiveRange (anyOf 1)objectNo
effectiveRange (anyOf 1).fromstringYesInclusive start timestamp; provide with to
effectiveRange (anyOf 1).tostringYesExclusive end timestamp; provide with from
effectiveRange (anyOf 2)nullNo
Complete JSON Schema
{
  "type": "object",
  "required": [
    "items",
    "hasMore",
    "nextCursor",
    "evaluatedAt",
    "effectiveRange"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "version",
          "etag",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Resource, job or operation identifier"
          },
          "version": {
            "type": "string",
            "pattern": "^(0|[1-9][0-9]*)$",
            "description": "Version as a decimal string; do not convert to a floating-point number"
          },
          "etag": {
            "type": "string",
            "description": "Concurrency tag; preserve quotes when sending If-Match"
          },
          "updatedAt": {
            "type": "string",
            "description": "Last server update timestamp"
          },
          "operationId": {
            "type": "string",
            "description": "Request receipt identifier; no status polling is needed"
          },
          "deletedAt": {
            "type": "string",
            "description": "Deletion timestamp"
          },
          "startTime": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Start timestamp in ISO 8601 with a time zone"
          },
          "stopTime": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Stop timestamp; null means running"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Entry description"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Note"
          },
          "projectId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Project ID, or null"
          },
          "tagIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tag IDs; comma-separated GET filter, array in bodies"
          },
          "source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Source label"
          },
          "state": {
            "type": "string",
            "description": "Entry, job or operation state; meaning depends on the endpoint"
          },
          "durationSeconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Duration in seconds; may be fractional"
          }
        },
        "additionalProperties": false
      },
      "description": "Resources, events or operation results"
    },
    "hasMore": {
      "type": "boolean",
      "description": "Whether another page is available"
    },
    "nextCursor": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Next-page cursor, or null on the final page"
    },
    "evaluatedAt": {
      "type": "string",
      "description": "Server evaluation timestamp"
    },
    "effectiveRange": {
      "anyOf": [
        {
          "type": "object",
          "required": [
            "from",
            "to"
          ],
          "properties": {
            "from": {
              "type": "string",
              "description": "Inclusive start timestamp; provide with to"
            },
            "to": {
              "type": "string",
              "description": "Exclusive end timestamp; provide with from"
            }
          }
        },
        {
          "type": "null"
        }
      ],
      "description": "Fixed effective range for this query"
    }
  }
}

400, 401, 403, 404, 413, 422, 429, 500, 503

Error response; branch on code.

application/json

Type: object

FieldTypeRequiredDescription and constraints
codestringYesMachine-readable error code
messagestringNoError message; use code for program logic
requestIdstringNoRequest trace identifier
operationIdstringNoRequest receipt identifier; no status polling is needed
Complete JSON Schema
{
  "type": "object",
  "required": [
    "code"
  ],
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Error message; use code for program logic"
    },
    "requestId": {
      "type": "string",
      "description": "Request trace identifier"
    },
    "operationId": {
      "type": "string",
      "description": "Request receipt identifier; no status polling is needed"
    }
  },
  "additionalProperties": true
}

On this page