# Scheduler

## Get execution history for scheduled task

> Returns recent execution history for a scheduled background task, including success/failure status and retry information.\
> \
> \## Authorization\
> Requires \`Scheduler.History\` scope.\
> \
> \## Task Identification\
> Tasks are identified by correlationId. Supports wildcard matching:\
> \- \`nightly-sync\` - Exact match\
> \- \`nightly-\*\` - Prefix match (all tasks starting with "nightly-")\
> \
> \## Use Cases\
> \- Task monitoring dashboards\
> \- Failure investigation\
> \- Performance analysis\
> \- Retry pattern verification

```json
{"openapi":"3.1.1","info":{"title":"Neostore internal API","version":"v1"},"tags":[{"name":"Scheduler"}],"servers":[{"url":"https://app.neostore.cloud","description":"Production Server"},{"url":"https://app-qa.neostore.cloud","description":"Staging Server"}],"security":[{"admin-bearer":["ScopedAuthorizeRequirement"]},{"apiKey":["ScopedAuthorizeRequirement"]}],"components":{"securitySchemes":{"admin-bearer":{"type":"oauth2","flows":{"implicit":{"authorizationUrl":"https://auth.neostore.cloud/authorize?audience=https://app.neostore.cloud/api/","scopes":{}}}},"apiKey":{"type":"apiKey","name":"X-API-KEY","in":"header"}},"schemas":{"Execution":{"required":["duration","id","retryIndex","startDate","success"],"type":"object","properties":{"id":{"type":"string"},"startDate":{"type":"string","format":"date-time"},"retryIndex":{"type":"integer","format":"int32"},"success":{"type":["null","boolean"]},"duration":{"type":["null","string"],"format":"date-span"}},"additionalProperties":false},"ExecutionDetail":{"required":["logs"],"type":"object","allOf":[{"$ref":"#/components/schemas/Execution"}],"properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/ExecutionLog"}}},"additionalProperties":false},"ExecutionLog":{"required":["data","entryType","eventDate","id"],"type":"object","properties":{"id":{"type":"string"},"eventDate":{"type":"string","format":"date-time"},"entryType":{"type":"string"},"data":{"type":["null","string"]}},"additionalProperties":false},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"type":["null","integer"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}},"additionalProperties":{}},"HttpValidationProblemDetails":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProblemDetails"}],"properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"additionalProperties":{}}}},"paths":{"/api/{tenantId}/scheduler/{taskId}/executions":{"get":{"tags":["Scheduler"],"summary":"Get execution history for scheduled task","description":"Returns recent execution history for a scheduled background task, including success/failure status and retry information.\n\n## Authorization\nRequires `Scheduler.History` scope.\n\n## Task Identification\nTasks are identified by correlationId. Supports wildcard matching:\n- `nightly-sync` - Exact match\n- `nightly-*` - Prefix match (all tasks starting with \"nightly-\")\n\n## Use Cases\n- Task monitoring dashboards\n- Failure investigation\n- Performance analysis\n- Retry pattern verification","parameters":[{"name":"taskId","in":"path","description":"CorrelationId of the scheduled task (supports a trailing * wildcard).","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Execution history retrieved successfully","content":{"text/plain":{"schema":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/Execution"},{"$ref":"#/components/schemas/ExecutionDetail"}]}}},"application/json":{"schema":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/Execution"},{"$ref":"#/components/schemas/ExecutionDetail"}]}}},"text/json":{"schema":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/Execution"},{"$ref":"#/components/schemas/ExecutionDetail"}]}}}}},"400":{"description":"Invalid taskId format","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"401":{"description":"Not authorized","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"500":{"description":"Internal server error while retrieving execution history"}}}}}}
```

## Retrieve a specific scheduler execution with its associated logs.

> Returns comprehensive execution details including all trace and dependency logs collected from Application Insights. Useful for debugging scheduled task issues and monitoring execution performance.

```json
{"openapi":"3.1.1","info":{"title":"Neostore internal API","version":"v1"},"tags":[{"name":"Scheduler"}],"servers":[{"url":"https://app.neostore.cloud","description":"Production Server"},{"url":"https://app-qa.neostore.cloud","description":"Staging Server"}],"security":[{"admin-bearer":["ScopedAuthorizeRequirement"]},{"apiKey":["ScopedAuthorizeRequirement"]}],"components":{"securitySchemes":{"admin-bearer":{"type":"oauth2","flows":{"implicit":{"authorizationUrl":"https://auth.neostore.cloud/authorize?audience=https://app.neostore.cloud/api/","scopes":{}}}},"apiKey":{"type":"apiKey","name":"X-API-KEY","in":"header"}},"schemas":{"ExecutionDetail":{"required":["logs"],"type":"object","allOf":[{"$ref":"#/components/schemas/Execution"}],"properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/ExecutionLog"}}},"additionalProperties":false},"Execution":{"required":["duration","id","retryIndex","startDate","success"],"type":"object","properties":{"id":{"type":"string"},"startDate":{"type":"string","format":"date-time"},"retryIndex":{"type":"integer","format":"int32"},"success":{"type":["null","boolean"]},"duration":{"type":["null","string"],"format":"date-span"}},"additionalProperties":false},"ExecutionLog":{"required":["data","entryType","eventDate","id"],"type":"object","properties":{"id":{"type":"string"},"eventDate":{"type":"string","format":"date-time"},"entryType":{"type":"string"},"data":{"type":["null","string"]}},"additionalProperties":false},"ProblemDetails":{"type":"object","properties":{"type":{"type":["null","string"]},"title":{"type":["null","string"]},"status":{"type":["null","integer"],"format":"int32"},"detail":{"type":["null","string"]},"instance":{"type":["null","string"]}},"additionalProperties":{}},"HttpValidationProblemDetails":{"type":"object","allOf":[{"$ref":"#/components/schemas/ProblemDetails"}],"properties":{"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}},"additionalProperties":{}}}},"paths":{"/api/{tenantId}/scheduler/{taskId}/executions/{executionId}":{"get":{"tags":["Scheduler"],"summary":"Retrieve a specific scheduler execution with its associated logs.","description":"Returns comprehensive execution details including all trace and dependency logs collected from Application Insights. Useful for debugging scheduled task issues and monitoring execution performance.","parameters":[{"name":"taskId","in":"path","description":"CorrelationId of the scheduled task.","required":true,"schema":{"type":"string"}},{"name":"executionId","in":"path","description":"Execution Id reported by Application Insights.","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Execution details with logs retrieved successfully","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/ExecutionDetail"}},"application/json":{"schema":{"$ref":"#/components/schemas/ExecutionDetail"}},"text/json":{"schema":{"$ref":"#/components/schemas/ExecutionDetail"}}}},"400":{"description":"Invalid taskId or executionId format","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"401":{"description":"Not authorized","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"404":{"description":"Execution not found","content":{"text/plain":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}},"text/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/ProblemDetails"},{"$ref":"#/components/schemas/HttpValidationProblemDetails"}]}}}},"500":{"description":"Internal server error while retrieving execution detail"}}}}}}
```
