# Jobs

## GET /api/v1/jobs/{engine\_id}/latest/

> Latest job

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"JobSchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"engine_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Engine Id"},"workflow_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Workflow Id"},"type":{"$ref":"#/components/schemas/JobType"},"status":{"$ref":"#/components/schemas/JobStatus"},"created":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Created"},"last_updated":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Last Updated"},"settings":{"anyOf":[{"type":"string"},{"type":"object"},{"type":"null"}],"default":null,"title":"Settings"},"now":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Now"},"attachment_types":{"anyOf":[{"items":{"$ref":"#/components/schemas/JobAttachmentType"},"type":"array"},{"type":"null"}],"default":null,"title":"Attachment Types"}},"required":["id","type","status"],"title":"JobSchema","type":"object"},"JobType":{"enum":["synthesize","fk_scan","pii_scan","subsetting","create_engine","update_engine","update_engine_settings","schema_resolve","sync_target","import_engine","export_engine"],"title":"JobType","type":"string"},"JobStatus":{"enum":["STARTED","IN_PROGRESS","SUCCESS","FAILURE","REVOKED"],"title":"JobStatus","type":"string"},"JobAttachmentType":{"enum":["LOG","PRIVACY_REPORT","IMPORTED_ENGINE"],"title":"JobAttachmentType","type":"string"},"HTTPValidationError":{"properties":{"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"},{"type":"null"}],"default":null,"title":"Errors"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/jobs/{engine_id}/latest/":{"get":{"operationId":"jobs_latest_retrieve","description":"Latest job","parameters":[{"in":"path","name":"engine_id","schema":{"type":"string"},"required":true},{"in":"query","name":"job_type","schema":{"type":"string"},"required":true}],"tags":["Jobs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobSchema"}}},"description":"Success: Job details"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## GET /api/v1/jobs/{engine\_id}/list/

> List jobs

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"ListOfJobSchema":{"properties":{"jobs":{"items":{"$ref":"#/components/schemas/JobSchema"},"title":"Jobs","type":"array"}},"required":["jobs"],"title":"ListOfJobSchema","type":"object"},"JobSchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"engine_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Engine Id"},"workflow_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Workflow Id"},"type":{"$ref":"#/components/schemas/JobType"},"status":{"$ref":"#/components/schemas/JobStatus"},"created":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Created"},"last_updated":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Last Updated"},"settings":{"anyOf":[{"type":"string"},{"type":"object"},{"type":"null"}],"default":null,"title":"Settings"},"now":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Now"},"attachment_types":{"anyOf":[{"items":{"$ref":"#/components/schemas/JobAttachmentType"},"type":"array"},{"type":"null"}],"default":null,"title":"Attachment Types"}},"required":["id","type","status"],"title":"JobSchema","type":"object"},"JobType":{"enum":["synthesize","fk_scan","pii_scan","subsetting","create_engine","update_engine","update_engine_settings","schema_resolve","sync_target","import_engine","export_engine"],"title":"JobType","type":"string"},"JobStatus":{"enum":["STARTED","IN_PROGRESS","SUCCESS","FAILURE","REVOKED"],"title":"JobStatus","type":"string"},"JobAttachmentType":{"enum":["LOG","PRIVACY_REPORT","IMPORTED_ENGINE"],"title":"JobAttachmentType","type":"string"},"HTTPValidationError":{"properties":{"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"},{"type":"null"}],"default":null,"title":"Errors"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/jobs/{engine_id}/list/":{"get":{"operationId":"jobs_list","description":"List jobs","parameters":[{"in":"path","name":"engine_id","schema":{"type":"string"},"required":true},{"in":"query","name":"job_type","schema":{"type":"string","enum":["create_engine","export_engine","fk_scan","import_engine","pii_scan","schema_resolve","subsetting","sync_target","synthesize","update_engine","update_engine_settings"]}}],"tags":["Jobs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListOfJobSchema"}}},"description":"Success: Jobs list"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## GET /api/v1/jobs/{job\_id}/

> Get Job

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"JobSchema":{"properties":{"id":{"format":"uuid","title":"Id","type":"string"},"engine_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Engine Id"},"workflow_id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Workflow Id"},"type":{"$ref":"#/components/schemas/JobType"},"status":{"$ref":"#/components/schemas/JobStatus"},"created":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Created"},"last_updated":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Last Updated"},"settings":{"anyOf":[{"type":"string"},{"type":"object"},{"type":"null"}],"default":null,"title":"Settings"},"now":{"anyOf":[{"format":"date-time","type":"string"},{"type":"null"}],"default":null,"title":"Now"},"attachment_types":{"anyOf":[{"items":{"$ref":"#/components/schemas/JobAttachmentType"},"type":"array"},{"type":"null"}],"default":null,"title":"Attachment Types"}},"required":["id","type","status"],"title":"JobSchema","type":"object"},"JobType":{"enum":["synthesize","fk_scan","pii_scan","subsetting","create_engine","update_engine","update_engine_settings","schema_resolve","sync_target","import_engine","export_engine"],"title":"JobType","type":"string"},"JobStatus":{"enum":["STARTED","IN_PROGRESS","SUCCESS","FAILURE","REVOKED"],"title":"JobStatus","type":"string"},"JobAttachmentType":{"enum":["LOG","PRIVACY_REPORT","IMPORTED_ENGINE"],"title":"JobAttachmentType","type":"string"},"HTTPValidationError":{"properties":{"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"},{"type":"null"}],"default":null,"title":"Errors"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/jobs/{job_id}/":{"get":{"operationId":"jobs_retrieve","description":"Get Job","parameters":[{"in":"path","name":"job_id","schema":{"type":"string"},"required":true}],"tags":["Jobs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobSchema"}}},"description":"Success: Job details"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## PUT /api/v1/jobs/{job\_id}/cancel/

> Cancel job

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"JobMessageSchema":{"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Id"},"status":{"anyOf":[{"$ref":"#/components/schemas/JobStatus"},{"type":"null"}],"default":null},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Reason"}},"title":"JobMessageSchema","type":"object"},"JobStatus":{"enum":["STARTED","IN_PROGRESS","SUCCESS","FAILURE","REVOKED"],"title":"JobStatus","type":"string"},"HTTPValidationError":{"properties":{"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"},{"type":"null"}],"default":null,"title":"Errors"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/jobs/{job_id}/cancel/":{"put":{"operationId":"jobs_cancel_update","description":"Cancel job","parameters":[{"in":"path","name":"job_id","schema":{"type":"string"},"required":true}],"tags":["Jobs","Workspaces"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobMessageSchema"}}},"description":"Success: Job status"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## DELETE /api/v1/jobs/{job\_id}/delete/

> Delete job

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"JobMessageSchema":{"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Id"},"status":{"anyOf":[{"$ref":"#/components/schemas/JobStatus"},{"type":"null"}],"default":null},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Reason"}},"title":"JobMessageSchema","type":"object"},"JobStatus":{"enum":["STARTED","IN_PROGRESS","SUCCESS","FAILURE","REVOKED"],"title":"JobStatus","type":"string"},"HTTPValidationError":{"properties":{"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"},{"type":"null"}],"default":null,"title":"Errors"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/jobs/{job_id}/delete/":{"delete":{"operationId":"jobs_delete_destroy","description":"Delete job","parameters":[{"in":"path","name":"job_id","schema":{"type":"string"},"required":true}],"tags":["Jobs","Workspaces"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobMessageSchema"}}},"description":"Success: Job status"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```

## GET /api/v1/jobs/{job\_id}/download\_log/

> Job logs

```json
{"openapi":"3.0.3","info":{"title":"Syntho Backend API","version":"1.0.0 (v1)"},"servers":[{"url":"/"}],"security":[{"authentication":[]},{"OIDC":[]}],"components":{"securitySchemes":{"authentication":{"type":"apiKey","in":"cookie","name":"sessionid","description":"Log in using the <a href='/api/playground/#/Auth/auth_create'>POST /api/v1/auth/</a> endpoint"},"OIDC":{"type":"apiKey","in":"header","name":"Authorization"}},"schemas":{"JobLogSchema":{"properties":{"id":{"anyOf":[{"format":"uuid","type":"string"},{"type":"null"}],"default":null,"title":"Id"},"log":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"title":"Log"}},"title":"JobLogSchema","type":"object"},"HTTPValidationError":{"properties":{"errors":{"anyOf":[{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array"},{"type":"null"}],"default":null,"title":"Errors"}},"title":"HTTPValidationError","type":"object"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"title":"Location","type":"array"},"msg":{"title":"Message","type":"string"},"type":{"title":"Error Type","type":"string"}},"required":["loc","msg","type"],"title":"ValidationError","type":"object"}}},"paths":{"/api/v1/jobs/{job_id}/download_log/":{"get":{"operationId":"jobs_download_log_retrieve","description":"Job logs","parameters":[{"in":"path","name":"job_id","schema":{"type":"string"},"required":true}],"tags":["Jobs"],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobLogSchema"}}},"description":"Success: Job log"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"description":"Validation error"},"503":{"description":"Message: unable to fetch engine from external service"}}}}}}
```
