> For the complete documentation index, see [llms.txt](https://docs.pending.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pending.ai/api-reference/pai-retro/batch-screening.md). Agents can also search and read this documentation through its [MCP server](https://docs.pending.ai/~gitbook/mcp).

# Batch Screening

Screen large batches of molecules using our high-throughput retrosynthesis

A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved. Batch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field. See [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability.

## List Batches

> Retrieve a list of Batch resources using cursor-based pagination. See the\
> returned \`data\` field for more information about the Batch resources. Use\
> additional \`metadata\` and \`links\` fields to navigate the paginated\
> resources.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CursorPage_Batch_":{"properties":{"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/Batch"},"type":"array","maxItems":100,"minItems":0,"title":"Data","description":"List of items for the current page. The number of items is not guaranteed\nto match the requested `limit` as fewer items may be available."},"metadata":{"$ref":"#/components/schemas/CursorPageMetadata","title":"Metadata"},"links":{"$ref":"#/components/schemas/PageLinks","title":"Links"}},"type":"object","required":["metadata","links"],"title":"CursorPage[Batch]"},"Batch":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"batch"},"name":{"anyOf":[{"type":"string","maxLength":512,"minLength":1,"pattern":"^.*\\S.*$","description":"Name of the resource. The name is a human-readable identifier and\nis not required to be unique. The value can be used for display\npurposes."},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^.*\\S.*$","description":"Description for a batch. Any text is allowed to provide additional\ncontext but must contain at least one non-whitespace character."},{"type":"null"}],"title":"Description"},"filename":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^[^/\\\\<>:\"|?*]+$","description":"Filename used for when a batch is submitted via file. This helps\nidentify the batch and provides context for its retrosynthesis jobs."},{"type":"null"}],"title":"Filename"},"created":{"type":"string","format":"date-time","title":"Created","description":"A timestamp for when the resource was created."},"updated":{"type":"string","format":"date-time","title":"Updated","description":"A timestamp for when the resource was last updated."},"number_of_jobs":{"type":"integer","maximum":100000,"minimum":1,"title":"Number Of Jobs","description":"Total number of retrosynthesis jobs that belong to a batch. The\nvalue can change over time as new jobs are added to the batch."},"status":{"$ref":"#/components/schemas/BatchStatus","title":"Status","description":"Current status of a batch determined by the number of submitted and\ncompleted retrosynthesis jobs. The value changes throughout the\nbatched retrosynthesis cycle.","default":"submitted"},"completed_jobs":{"type":"integer","maximum":100000,"minimum":0,"title":"Completed Jobs","description":"Number of completed retrosynthesis jobs in the batch.","default":0},"jobs_created":{"type":"boolean","title":"Jobs Created","description":"Whether background job creation for this batch has finished.\n`false` means the batch's retrosynthesis jobs are still being\nqueued and written -- `number_of_jobs` is already accurate, but\njob resources may not exist yet. If this stays `false` for an\nextended period, job creation may be stuck or has failed.","default":true},"parameters":{"$ref":"#/components/schemas/BatchParameters","title":"Parameters"}},"type":"object","required":["id","number_of_jobs","parameters"],"title":"Batch","description":"Batches are collections of retrosynthesis jobs with shared parameters.\n\nBatches allow for easy management of large sets of synthesis targets and\nprovide a mechanism for tracking the status of multiple jobs simultaneously.\nThere is an upper limit of jobs per batch which is enforced by the system."},"BatchStatus":{"type":"string","enum":["submitted","processing","completed"],"title":"BatchStatus","description":"Enumeration of possible batch statuses."},"BatchParameters":{"properties":{"retrosynthesis_engine":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Retrosynthesis Engine","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},"building_block_libraries":{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"title":"Building Block Libraries","description":"The building block libraries the job's routes end in. Empty on a TwinOracle (`synth-`) engine, which prices its own building blocks."},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","required":["retrosynthesis_engine","building_block_libraries"],"title":"BatchParameters","description":"A batch's job parameters, with TwinOracle's options on a `synth-` engine."},"SynthOptions":{"properties":{"max_price":{"type":"number","maximum":50000,"minimum":1,"title":"Max Price","description":"Leave out building blocks dearer than this, in USD per gram.","default":10000},"max_depth":{"type":"integer","maximum":20,"minimum":1,"title":"Max Depth","description":"Most steps a route may have.","default":12},"timeout":{"type":"integer","maximum":15,"minimum":2,"title":"Timeout","description":"Each search's time limit, in seconds.","default":10},"early_exit":{"type":"boolean","title":"Early Exit","description":"Stop each search at the first route.","default":true},"max_routes":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"title":"Max Routes","description":"Most routes to keep for each molecule; every route found if omitted. Different ways to make the molecule are kept before other building blocks for the same route."}},"type":"object","title":"SynthOptions","description":"TwinOracle (PAI Synth) search options, for a job or batch on a `synth-` engine.\n\nThe same options, with the same limits, as a single fast search in the web\napp (retro-api-webapp's `SynthOptions`, stored on each job as its camel-cased\n`synthOptions`). Ignored on a Mentor engine."},"CursorPageMetadata":{"properties":{"has_next":{"type":"boolean","title":"Has Next","description":"Indicates if there is a next page of results. If true, the next set of\nresults can be fetched using `next_cursor` to populate the `after`\nfield in the next request, or requesting the next page.","default":false},"has_prev":{"type":"boolean","title":"Has Prev","description":"Indicates if there is a previous page of results. If true, the previous\nset of results can be fetched using `prev_cursor` to populate the\n`before` field in the next request, or requesting the previous page.","default":false},"next_cursor":{"anyOf":[{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"If provided, matches the cursor to be used for fetching the page of\nresults after the current one. See specific resource documentation for\ndetails on the sort order of results."},{"type":"null"}],"title":"Next Cursor"},"prev_cursor":{"anyOf":[{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"If provided, matches the cursor to be used for fetching the page of\nresults before the current one. See specific resource documentation for\ndetails on the sort order of results."},{"type":"null"}],"title":"Prev Cursor"}},"type":"object","title":"CursorPageMetadata","description":"Metadata that contains state information for cursor-based pages."},"PageLinks":{"properties":{"self":{"type":"string","maxLength":100000,"minLength":1,"title":"Self","description":"Relative URL path for the current page of results. This can be used to\nfetch the same page of results again from the API."},"next":{"anyOf":[{"type":"string","maxLength":100000,"minLength":1,"description":"Relative URL path for the next page of results. This can be used to\nfetch the next page of results from the API."},{"type":"null"}],"title":"Next"},"prev":{"anyOf":[{"type":"string","maxLength":100000,"minLength":1,"description":"Relative URL path for the previous page of results. This can be used to\nfetch the previous page of results from the API."},{"type":"null"}],"title":"Prev"}},"type":"object","required":["self"],"title":"PageLinks","description":"Links that contain information about the pagination state."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches":{"get":{"tags":["Batches"],"summary":"List Batches","description":"Retrieve a list of Batch resources using cursor-based pagination. See the\nreturned `data` field for more information about the Batch resources. Use\nadditional `metadata` and `links` fields to navigate the paginated\nresources.","operationId":"retrieve_batch_list_batches_get","parameters":[{"description":"\n            An *optional* cursor used to indicate the item after which\n            results should be returned. When provided, results that come\n            after the specified cursor are returned. Cannot be used\n            together with the `before` parameter.\n\n            Note that results are returned in descending order so the\n            `after` cursor returns older items that appear in pages that\n            are *after* the current page.\n            ","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"After","description":"\n            An *optional* cursor used to indicate the item after which\n            results should be returned. When provided, results that come\n            after the specified cursor are returned. Cannot be used\n            together with the `before` parameter.\n\n            Note that results are returned in descending order so the\n            `after` cursor returns older items that appear in pages that\n            are *after* the current page.\n            "},"name":"after","in":"query"},{"description":"\n            An *optional* cursor used to indicate the item before which\n            results should be returned. When provided, results that come\n            before the specified cursor are returned. Cannot be used\n            together with the `after` parameter.\n\n            Note that results are returned in descending order so the\n            `before` cursor returns newer items that appear in pages\n            that are *before* the current page.\n            ","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before","description":"\n            An *optional* cursor used to indicate the item before which\n            results should be returned. When provided, results that come\n            before the specified cursor are returned. Cannot be used\n            together with the `after` parameter.\n\n            Note that results are returned in descending order so the\n            `before` cursor returns newer items that appear in pages\n            that are *before* the current page.\n            "},"name":"before","in":"query"},{"description":"\n                The **maximum** number of results to return for a single page\n                of items. The value can adversely affect offset-based pagination\n                when using the `page` parameter. Fewer results can be returned\n                than the value specified.\n                ","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"title":"Limit","description":"\n                The **maximum** number of results to return for a single page\n                of items. The value can adversely affect offset-based pagination\n                when using the `page` parameter. Fewer results can be returned\n                than the value specified.\n                ","default":25},"name":"limit","in":"query"},{"description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats."},"name":"accept-encoding","in":"header"}],"responses":{"200":{"description":"Returns a list of Batches","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorPage_Batch_"}}}},"400":{"description":"Malformed request data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## Create a Batch

> Create a new Batch resource to manage a collection of retrosynthesis Job\
> resources. Individual jobs are provided as a collection of SMILES structures\
> and share a set of parameters.\
> \
> \- Provide additional metadata to tag and identify the batch.\
> \- The batch size limit is 100000 jobs; for larger batches, split query\
> molecules into manageable batches or update an initial Batch resource after\
> creation.\
> \- A TwinOracle engine (\`synth-\<id>\`, where offered) runs each molecule as a\
> fast search: its jobs take \`synth\_options\` (defaults if omitted) and no\
> building block libraries, since TwinOracle prices its own.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateBatch":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":512,"minLength":1,"pattern":"^.*\\S.*$","description":"Name of the resource. The name is a human-readable identifier and\nis not required to be unique. The value can be used for display\npurposes."},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^.*\\S.*$","description":"Description for a batch. Any text is allowed to provide additional\ncontext but must contain at least one non-whitespace character."},{"type":"null"}],"title":"Description"},"filename":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^[^/\\\\<>:\"|?*]+$","description":"Filename used for when a batch is submitted via file. This helps\nidentify the batch and provides context for its retrosynthesis jobs."},{"type":"null"}],"title":"Filename"},"smiles":{"items":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","description":"A SMILES string representing a molecule. For more information, refer to the OpenSMILES specification available online [here](http://opensmiles.org/opensmiles.html)."},"type":"array","maxItems":100000,"minItems":1,"title":"Smiles","description":"List of SMILES structures representing molecules to be submitted\nfor retrosynthesis. Each query structure shares the same parameters\ndefined for the batch. Duplicates and empty structures are removed."},"parameters":{"$ref":"#/components/schemas/CreateBatchParameters","title":"Parameters"}},"type":"object","required":["smiles"],"title":"CreateBatch","description":"Request body for creating a new Batch."},"CreateBatchParameters":{"properties":{"retrosynthesis_engine":{"anyOf":[{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},{"type":"null"}],"title":"Retrosynthesis Engine"},"building_block_libraries":{"anyOf":[{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"minItems":1,"description":"A list of IDs belonging to selected library resources used\nfor controlling synthetic route termination. The value can be\nomitted to use all libraries. At least one must be provided."},{"type":"null"}],"title":"Building Block Libraries"},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","title":"CreateBatchParameters","description":"Parameters for a new batch's jobs.\n\n`retrosynthesis_engine` may also be a TwinOracle engine (`synth-<id>`, as the\nweb app lists them), whose jobs take `synth_options` -- defaults if omitted --\nand no building block libraries: TwinOracle prices its own."},"SynthOptions":{"properties":{"max_price":{"type":"number","maximum":50000,"minimum":1,"title":"Max Price","description":"Leave out building blocks dearer than this, in USD per gram.","default":10000},"max_depth":{"type":"integer","maximum":20,"minimum":1,"title":"Max Depth","description":"Most steps a route may have.","default":12},"timeout":{"type":"integer","maximum":15,"minimum":2,"title":"Timeout","description":"Each search's time limit, in seconds.","default":10},"early_exit":{"type":"boolean","title":"Early Exit","description":"Stop each search at the first route.","default":true},"max_routes":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"title":"Max Routes","description":"Most routes to keep for each molecule; every route found if omitted. Different ways to make the molecule are kept before other building blocks for the same route."}},"type":"object","title":"SynthOptions","description":"TwinOracle (PAI Synth) search options, for a job or batch on a `synth-` engine.\n\nThe same options, with the same limits, as a single fast search in the web\napp (retro-api-webapp's `SynthOptions`, stored on each job as its camel-cased\n`synthOptions`). Ignored on a Mentor engine."},"Batch":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"batch"},"name":{"anyOf":[{"type":"string","maxLength":512,"minLength":1,"pattern":"^.*\\S.*$","description":"Name of the resource. The name is a human-readable identifier and\nis not required to be unique. The value can be used for display\npurposes."},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^.*\\S.*$","description":"Description for a batch. Any text is allowed to provide additional\ncontext but must contain at least one non-whitespace character."},{"type":"null"}],"title":"Description"},"filename":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^[^/\\\\<>:\"|?*]+$","description":"Filename used for when a batch is submitted via file. This helps\nidentify the batch and provides context for its retrosynthesis jobs."},{"type":"null"}],"title":"Filename"},"created":{"type":"string","format":"date-time","title":"Created","description":"A timestamp for when the resource was created."},"updated":{"type":"string","format":"date-time","title":"Updated","description":"A timestamp for when the resource was last updated."},"number_of_jobs":{"type":"integer","maximum":100000,"minimum":1,"title":"Number Of Jobs","description":"Total number of retrosynthesis jobs that belong to a batch. The\nvalue can change over time as new jobs are added to the batch."},"status":{"$ref":"#/components/schemas/BatchStatus","title":"Status","description":"Current status of a batch determined by the number of submitted and\ncompleted retrosynthesis jobs. The value changes throughout the\nbatched retrosynthesis cycle.","default":"submitted"},"completed_jobs":{"type":"integer","maximum":100000,"minimum":0,"title":"Completed Jobs","description":"Number of completed retrosynthesis jobs in the batch.","default":0},"jobs_created":{"type":"boolean","title":"Jobs Created","description":"Whether background job creation for this batch has finished.\n`false` means the batch's retrosynthesis jobs are still being\nqueued and written -- `number_of_jobs` is already accurate, but\njob resources may not exist yet. If this stays `false` for an\nextended period, job creation may be stuck or has failed.","default":true},"parameters":{"$ref":"#/components/schemas/BatchParameters","title":"Parameters"}},"type":"object","required":["id","number_of_jobs","parameters"],"title":"Batch","description":"Batches are collections of retrosynthesis jobs with shared parameters.\n\nBatches allow for easy management of large sets of synthesis targets and\nprovide a mechanism for tracking the status of multiple jobs simultaneously.\nThere is an upper limit of jobs per batch which is enforced by the system."},"BatchStatus":{"type":"string","enum":["submitted","processing","completed"],"title":"BatchStatus","description":"Enumeration of possible batch statuses."},"BatchParameters":{"properties":{"retrosynthesis_engine":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Retrosynthesis Engine","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},"building_block_libraries":{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"title":"Building Block Libraries","description":"The building block libraries the job's routes end in. Empty on a TwinOracle (`synth-`) engine, which prices its own building blocks."},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","required":["retrosynthesis_engine","building_block_libraries"],"title":"BatchParameters","description":"A batch's job parameters, with TwinOracle's options on a `synth-` engine."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches":{"post":{"tags":["Batches"],"summary":"Create a Batch","description":"Create a new Batch resource to manage a collection of retrosynthesis Job\nresources. Individual jobs are provided as a collection of SMILES structures\nand share a set of parameters.\n\n- Provide additional metadata to tag and identify the batch.\n- The batch size limit is 100000 jobs; for larger batches, split query\nmolecules into manageable batches or update an initial Batch resource after\ncreation.\n- A TwinOracle engine (`synth-<id>`, where offered) runs each molecule as a\nfast search: its jobs take `synth_options` (defaults if omitted) and no\nbuilding block libraries, since TwinOracle prices its own.","operationId":"create_batch_batches_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBatch"}}},"required":true},"responses":{"200":{"description":"Returns the Batch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"description":"Malformed request data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"402":{"description":"Plan or usage limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}},"503":{"description":"Service is currently unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}}}}}}}
```

## Retrieve a Batch

> Retrieve a Batch resource by its ID. Additional object metadata and shared\
> Job parameters are included. Status and results are not included; use the\
> dedicated routes for those operations.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Batch":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"batch"},"name":{"anyOf":[{"type":"string","maxLength":512,"minLength":1,"pattern":"^.*\\S.*$","description":"Name of the resource. The name is a human-readable identifier and\nis not required to be unique. The value can be used for display\npurposes."},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^.*\\S.*$","description":"Description for a batch. Any text is allowed to provide additional\ncontext but must contain at least one non-whitespace character."},{"type":"null"}],"title":"Description"},"filename":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^[^/\\\\<>:\"|?*]+$","description":"Filename used for when a batch is submitted via file. This helps\nidentify the batch and provides context for its retrosynthesis jobs."},{"type":"null"}],"title":"Filename"},"created":{"type":"string","format":"date-time","title":"Created","description":"A timestamp for when the resource was created."},"updated":{"type":"string","format":"date-time","title":"Updated","description":"A timestamp for when the resource was last updated."},"number_of_jobs":{"type":"integer","maximum":100000,"minimum":1,"title":"Number Of Jobs","description":"Total number of retrosynthesis jobs that belong to a batch. The\nvalue can change over time as new jobs are added to the batch."},"status":{"$ref":"#/components/schemas/BatchStatus","title":"Status","description":"Current status of a batch determined by the number of submitted and\ncompleted retrosynthesis jobs. The value changes throughout the\nbatched retrosynthesis cycle.","default":"submitted"},"completed_jobs":{"type":"integer","maximum":100000,"minimum":0,"title":"Completed Jobs","description":"Number of completed retrosynthesis jobs in the batch.","default":0},"jobs_created":{"type":"boolean","title":"Jobs Created","description":"Whether background job creation for this batch has finished.\n`false` means the batch's retrosynthesis jobs are still being\nqueued and written -- `number_of_jobs` is already accurate, but\njob resources may not exist yet. If this stays `false` for an\nextended period, job creation may be stuck or has failed.","default":true},"parameters":{"$ref":"#/components/schemas/BatchParameters","title":"Parameters"}},"type":"object","required":["id","number_of_jobs","parameters"],"title":"Batch","description":"Batches are collections of retrosynthesis jobs with shared parameters.\n\nBatches allow for easy management of large sets of synthesis targets and\nprovide a mechanism for tracking the status of multiple jobs simultaneously.\nThere is an upper limit of jobs per batch which is enforced by the system."},"BatchStatus":{"type":"string","enum":["submitted","processing","completed"],"title":"BatchStatus","description":"Enumeration of possible batch statuses."},"BatchParameters":{"properties":{"retrosynthesis_engine":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Retrosynthesis Engine","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},"building_block_libraries":{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"title":"Building Block Libraries","description":"The building block libraries the job's routes end in. Empty on a TwinOracle (`synth-`) engine, which prices its own building blocks."},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","required":["retrosynthesis_engine","building_block_libraries"],"title":"BatchParameters","description":"A batch's job parameters, with TwinOracle's options on a `synth-` engine."},"SynthOptions":{"properties":{"max_price":{"type":"number","maximum":50000,"minimum":1,"title":"Max Price","description":"Leave out building blocks dearer than this, in USD per gram.","default":10000},"max_depth":{"type":"integer","maximum":20,"minimum":1,"title":"Max Depth","description":"Most steps a route may have.","default":12},"timeout":{"type":"integer","maximum":15,"minimum":2,"title":"Timeout","description":"Each search's time limit, in seconds.","default":10},"early_exit":{"type":"boolean","title":"Early Exit","description":"Stop each search at the first route.","default":true},"max_routes":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"title":"Max Routes","description":"Most routes to keep for each molecule; every route found if omitted. Different ways to make the molecule are kept before other building blocks for the same route."}},"type":"object","title":"SynthOptions","description":"TwinOracle (PAI Synth) search options, for a job or batch on a `synth-` engine.\n\nThe same options, with the same limits, as a single fast search in the web\napp (retro-api-webapp's `SynthOptions`, stored on each job as its camel-cased\n`synthOptions`). Ignored on a Mentor engine."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}":{"get":{"tags":["Batches"],"summary":"Retrieve a Batch","description":"Retrieve a Batch resource by its ID. Additional object metadata and shared\nJob parameters are included. Status and results are not included; use the\ndedicated routes for those operations.","operationId":"retrieve_batch_batches__batch_id__get","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"}],"responses":{"200":{"description":"Returns the Batch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## Update a Batch

> Update a Batch and submit extra retrosynthesis Job resources. The number of\
> jobs must not exceed the batch size limit of 100000. SMILES structures\
> are not checked for duplicates against existing jobs in the batch, so care\
> must be taken to avoid adding the same molecule multiple times.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UpdateBatch":{"properties":{"smiles":{"items":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","description":"A SMILES string representing a molecule. For more information, refer to the OpenSMILES specification available online [here](http://opensmiles.org/opensmiles.html)."},"type":"array","maxItems":100000,"minItems":1,"title":"Smiles","description":"List of SMILES structures representing molecules to be submitted\nfor retrosynthesis. Each query structure shares the same parameters\ndefined for the batch. Duplicates and empty structures are removed."}},"type":"object","required":["smiles"],"title":"UpdateBatch","description":"Request body for updating a Batch."},"Batch":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"batch"},"name":{"anyOf":[{"type":"string","maxLength":512,"minLength":1,"pattern":"^.*\\S.*$","description":"Name of the resource. The name is a human-readable identifier and\nis not required to be unique. The value can be used for display\npurposes."},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^.*\\S.*$","description":"Description for a batch. Any text is allowed to provide additional\ncontext but must contain at least one non-whitespace character."},{"type":"null"}],"title":"Description"},"filename":{"anyOf":[{"type":"string","maxLength":2048,"minLength":1,"pattern":"^[^/\\\\<>:\"|?*]+$","description":"Filename used for when a batch is submitted via file. This helps\nidentify the batch and provides context for its retrosynthesis jobs."},{"type":"null"}],"title":"Filename"},"created":{"type":"string","format":"date-time","title":"Created","description":"A timestamp for when the resource was created."},"updated":{"type":"string","format":"date-time","title":"Updated","description":"A timestamp for when the resource was last updated."},"number_of_jobs":{"type":"integer","maximum":100000,"minimum":1,"title":"Number Of Jobs","description":"Total number of retrosynthesis jobs that belong to a batch. The\nvalue can change over time as new jobs are added to the batch."},"status":{"$ref":"#/components/schemas/BatchStatus","title":"Status","description":"Current status of a batch determined by the number of submitted and\ncompleted retrosynthesis jobs. The value changes throughout the\nbatched retrosynthesis cycle.","default":"submitted"},"completed_jobs":{"type":"integer","maximum":100000,"minimum":0,"title":"Completed Jobs","description":"Number of completed retrosynthesis jobs in the batch.","default":0},"jobs_created":{"type":"boolean","title":"Jobs Created","description":"Whether background job creation for this batch has finished.\n`false` means the batch's retrosynthesis jobs are still being\nqueued and written -- `number_of_jobs` is already accurate, but\njob resources may not exist yet. If this stays `false` for an\nextended period, job creation may be stuck or has failed.","default":true},"parameters":{"$ref":"#/components/schemas/BatchParameters","title":"Parameters"}},"type":"object","required":["id","number_of_jobs","parameters"],"title":"Batch","description":"Batches are collections of retrosynthesis jobs with shared parameters.\n\nBatches allow for easy management of large sets of synthesis targets and\nprovide a mechanism for tracking the status of multiple jobs simultaneously.\nThere is an upper limit of jobs per batch which is enforced by the system."},"BatchStatus":{"type":"string","enum":["submitted","processing","completed"],"title":"BatchStatus","description":"Enumeration of possible batch statuses."},"BatchParameters":{"properties":{"retrosynthesis_engine":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Retrosynthesis Engine","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},"building_block_libraries":{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"title":"Building Block Libraries","description":"The building block libraries the job's routes end in. Empty on a TwinOracle (`synth-`) engine, which prices its own building blocks."},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","required":["retrosynthesis_engine","building_block_libraries"],"title":"BatchParameters","description":"A batch's job parameters, with TwinOracle's options on a `synth-` engine."},"SynthOptions":{"properties":{"max_price":{"type":"number","maximum":50000,"minimum":1,"title":"Max Price","description":"Leave out building blocks dearer than this, in USD per gram.","default":10000},"max_depth":{"type":"integer","maximum":20,"minimum":1,"title":"Max Depth","description":"Most steps a route may have.","default":12},"timeout":{"type":"integer","maximum":15,"minimum":2,"title":"Timeout","description":"Each search's time limit, in seconds.","default":10},"early_exit":{"type":"boolean","title":"Early Exit","description":"Stop each search at the first route.","default":true},"max_routes":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"title":"Max Routes","description":"Most routes to keep for each molecule; every route found if omitted. Different ways to make the molecule are kept before other building blocks for the same route."}},"type":"object","title":"SynthOptions","description":"TwinOracle (PAI Synth) search options, for a job or batch on a `synth-` engine.\n\nThe same options, with the same limits, as a single fast search in the web\napp (retro-api-webapp's `SynthOptions`, stored on each job as its camel-cased\n`synthOptions`). Ignored on a Mentor engine."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}":{"put":{"tags":["Batches"],"summary":"Update a Batch","description":"Update a Batch and submit extra retrosynthesis Job resources. The number of\njobs must not exceed the batch size limit of 100000. SMILES structures\nare not checked for duplicates against existing jobs in the batch, so care\nmust be taken to avoid adding the same molecule multiple times.","operationId":"update_batch_batches__batch_id__put","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBatch"}}},"required":true},"responses":{"200":{"description":"Returns the Batch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Batch"}}}},"400":{"description":"Malformed request data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"402":{"description":"Plan or usage limit reached.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## Delete a Batch

> Delete a Batch and each attached retrosynthesis Job resource. All remaining\
> queued jobs are cancelled even if the batch is currently being processed.\
> The customer metered usage is updated to reflect any incomplete jobs.\
> \
> The Batch itself is deleted immediately, but attached Job resources are\
> archived and the metered usage adjustment applied shortly afterwards in\
> the background, so a large batch's deletion is not held up by request\
> timeouts.\
> \
> Note that the operation is non-reversible and all resources are no longer\
> accessible after deletion.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"DeleteResource":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource."},"deleted":{"type":"boolean","title":"Deleted","description":"Indicates whether the resource was successfully deleted.","default":true}},"type":"object","required":["id","object"],"title":"DeleteResource","description":"The deletion status when a resource is deleted."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}":{"delete":{"tags":["Batches"],"summary":"Delete a Batch","description":"Delete a Batch and each attached retrosynthesis Job resource. All remaining\nqueued jobs are cancelled even if the batch is currently being processed.\nThe customer metered usage is updated to reflect any incomplete jobs.\n\nThe Batch itself is deleted immediately, but attached Job resources are\narchived and the metered usage adjustment applied shortly afterwards in\nthe background, so a large batch's deletion is not held up by request\ntimeouts.\n\nNote that the operation is non-reversible and all resources are no longer\naccessible after deletion.","operationId":"delete_batch_batches__batch_id__delete","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"}],"responses":{"200":{"description":"Returns the deletion status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteResource"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## Retrieve a Batch status

> Retrieve the current status of a Batch. The status relies on the individual\
> status of all Job resources making it a computationally expensive operation.\
> Poll the route with spaced requests to reduce the load on the server.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"BatchProgress":{"properties":{"status":{"$ref":"#/components/schemas/BatchStatus","title":"Status","description":"Current status of a batch determined by the number of submitted and\ncompleted retrosynthesis jobs. The value changes throughout the\nbatched retrosynthesis cycle."},"number_of_jobs":{"type":"integer","maximum":100000,"minimum":1,"title":"Number Of Jobs","description":"Total number of retrosynthesis jobs that belong to a batch. The\nvalue can change over time as new jobs are added to the batch."},"completed_jobs":{"type":"integer","maximum":100000,"minimum":0,"title":"Completed Jobs","description":"Number of completed retrosynthesis jobs in the batch.","default":0},"jobs_created":{"type":"boolean","title":"Jobs Created","description":"Whether background job creation for this batch has finished.\n`false` means the batch's retrosynthesis jobs are still being\nqueued and written -- `number_of_jobs` is already accurate, but\njob resources may not exist yet. If this stays `false` for an\nextended period, job creation may be stuck or has failed.","default":true}},"type":"object","required":["status","number_of_jobs"],"title":"BatchProgress","description":"Status information for a Batch.\n\nNot named `BatchStatus`: that is the status enum in `api_lib_core`, and two\nmodels of one name give both long, module-qualified names in the OpenAPI spec.\n\nBatches require routine polling to determine when all jobs are completed.\nA batch will be completed once all retrosynthesis jobs are finished."},"BatchStatus":{"type":"string","enum":["submitted","processing","completed"],"title":"BatchStatus","description":"Enumeration of possible batch statuses."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}/status":{"get":{"tags":["Batches"],"summary":"Retrieve a Batch status","description":"Retrieve the current status of a Batch. The status relies on the individual\nstatus of all Job resources making it a computationally expensive operation.\nPoll the route with spaced requests to reduce the load on the server.","operationId":"retrieve_batch_status_batches__batch_id__status_get","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"}],"responses":{"200":{"description":"Returns the Batch status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchProgress"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## Retrieve a Batch result

> Retrieve the collection of results from all Job resources for the Batch. The\
> list contains each job ID to use for retrieving synthetic routes and whether\
> a query molecule was synthesizable. Incomplete jobs are marked as such.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"BatchResult":{"properties":{"job_id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Job Id","description":"Unique identifier of the retrosynthesis job. Use this value\nto retrieve individual retrosynthesis results from the\ndedicated API endpoint."},"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","title":"Smiles","description":"SMILES structure of the retrosynthesis job."},"completed":{"type":"boolean","title":"Completed","description":"A flag to indicate if the job has completed. Retrieving results\nbefore a batch status has transitioned to completed may contain\nincomplete jobs."},"synthesizable":{"type":"boolean","title":"Synthesizable","description":"A flag to indicate if the SMILES structure was found to be\nsynthesizable. The value will be true if there is at least\none retrosynthesis route found."}},"type":"object","required":["job_id","smiles","completed","synthesizable"],"title":"BatchResult","description":"An individual retrosynthesis result for a Job."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}/result":{"get":{"tags":["Batches"],"summary":"Retrieve a Batch result","description":"Retrieve the collection of results from all Job resources for the Batch. The\nlist contains each job ID to use for retrieving synthetic routes and whether\na query molecule was synthesizable. Incomplete jobs are marked as such.","operationId":"retrieve_batch_result_batches__batch_id__result_get","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"},{"description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats."},"name":"accept-encoding","in":"header"}],"responses":{"200":{"description":"Returns the Batch result","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/BatchResult"},"type":"array","title":"Return"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## List a Batch's Jobs

> Retrieve a Batch's Job resources, with their routes, using cursor-based\
> pagination. Use the \`metadata\` and \`links\` fields to page through them.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CursorPage_Job_":{"properties":{"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/Job"},"type":"array","maxItems":100,"minItems":0,"title":"Data","description":"List of items for the current page. The number of items is not guaranteed\nto match the requested `limit` as fewer items may be available."},"metadata":{"$ref":"#/components/schemas/CursorPageMetadata","title":"Metadata"},"links":{"$ref":"#/components/schemas/PageLinks","title":"Links"}},"type":"object","required":["metadata","links"],"title":"CursorPage[Job]"},"Job":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"job"},"query":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","title":"Query","description":"A SMILES molecule to perform retrosynthesis on."},"status":{"$ref":"#/components/schemas/JobStatus","title":"Status","description":"The current status of the retrosynthesis job."},"created":{"type":"string","format":"date-time","title":"Created","description":"A timestamp for when the resource was created."},"updated":{"type":"string","format":"date-time","title":"Updated","description":"A timestamp for when the resource was last updated."},"parameters":{"$ref":"#/components/schemas/JobParameters","title":"Parameters"},"routes":{"items":{"$ref":"#/components/schemas/Route"},"type":"array","title":"Routes"},"query_is_building_block":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Query Is Building Block"},"ai_disclaimer":{"type":"string","maxLength":100000,"minLength":1,"title":"Ai Disclaimer","description":"Required EU AI Act compliance field. Provides a disclaimer about\nthe use of AI in generating retrosynthesis synthetic results.","default":"Pending AI's Retrosynthesis Engine is powered by artificial intelligence which is an experimental technology and may occasionally be misleading or incorrect."}},"type":"object","required":["id","query","status","parameters","routes"],"title":"Job","description":"A retrosynthesis Job for a single SMILES query molecule.\n\nJobs provide an interface for controlling the synthesis process and\nretrieving the detailed results from the retrosynthesis engine. The\nparameters provide more information about the job configuration."},"JobStatus":{"type":"string","enum":["submitted","processing","failed","completed"],"title":"JobStatus","description":"Job status enumeration."},"JobParameters":{"properties":{"retrosynthesis_engine":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Retrosynthesis Engine","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},"building_block_libraries":{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"title":"Building Block Libraries","description":"The building block libraries the job's routes end in. Empty on a TwinOracle (`synth-`) engine, which prices its own building blocks."},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","required":["retrosynthesis_engine","building_block_libraries"],"title":"JobParameters","description":"Retrosynthesis procedure configuration parameters."},"SynthOptions":{"properties":{"max_price":{"type":"number","maximum":50000,"minimum":1,"title":"Max Price","description":"Leave out building blocks dearer than this, in USD per gram.","default":10000},"max_depth":{"type":"integer","maximum":20,"minimum":1,"title":"Max Depth","description":"Most steps a route may have.","default":12},"timeout":{"type":"integer","maximum":15,"minimum":2,"title":"Timeout","description":"Each search's time limit, in seconds.","default":10},"early_exit":{"type":"boolean","title":"Early Exit","description":"Stop each search at the first route.","default":true},"max_routes":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"title":"Max Routes","description":"Most routes to keep for each molecule; every route found if omitted. Different ways to make the molecule are kept before other building blocks for the same route."}},"type":"object","title":"SynthOptions","description":"TwinOracle (PAI Synth) search options, for a job or batch on a `synth-` engine.\n\nThe same options, with the same limits, as a single fast search in the web\napp (retro-api-webapp's `SynthOptions`, stored on each job as its camel-cased\n`synthOptions`). Ignored on a Mentor engine."},"Route":{"properties":{"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\>]+$","title":"Smiles","description":"A SMILES representation of a synthetically accessible\nretrosynthetic route reaction tree. Reactants are purchasable\nbuilding blocks, and the product is the target molecule."},"building_blocks":{"items":{"$ref":"#/components/schemas/BuildingBlock"},"type":"array","title":"Building Blocks"},"steps":{"items":{"$ref":"#/components/schemas/ReactionStep"},"type":"array","title":"Steps"},"stereocenters_mapped":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stereocenters Mapped","description":"Whether the target molecule's stereocentres were traced through\nevery reaction step of the route to its building blocks, so the\nroute makes the stereoisomer that was asked for. `null` when the\nretrosynthesis engine did not report it."}},"type":"object","required":["smiles","building_blocks","steps"],"title":"Route","description":"A retrosynthesis route computed using a retrosynthesis engine.\n\nContains a collection of building blocks and single-step reactions that represent\na complete synthesis route for a target molecule through individual reactions that\nbuild bottom-up to the target molecule."},"BuildingBlock":{"properties":{"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","title":"Smiles","description":"A SMILES representation of a building block."},"metadata":{"items":{"$ref":"#/components/schemas/BuildingBlockMetadata"},"type":"array","title":"Metadata"}},"type":"object","required":["smiles","metadata"],"title":"BuildingBlock","description":"A building block molecule represented by a SMILES structure."},"BuildingBlockMetadata":{"properties":{"identifier":{"type":"string","maxLength":100000,"minLength":1,"title":"Identifier","description":"An identifier used for annotating building block molecules.\nDifferent annotation styles can be used to distinguish against\ndataset providers.","default":"unknown"},"dataset_provider":{"type":"string","maxLength":100000,"minLength":1,"title":"Dataset Provider","description":"Name of the dataset provider that owns and distributes a specified\nbuilding block molecule.","default":"unknown"},"availability":{"type":"string","maxLength":100000,"minLength":1,"title":"Availability","description":"The availability status of the building block molecule. A\nmolecule is `in stock` if it is available for purchase and\n`unavailable` otherwise.","default":"unavailable"},"price":{"type":"number","title":"Price","description":"Price of the building block molecule for a specific\n`dataset_provider`. A molecule can have different prices\ndepending on the provider. Prices are subject to change over\ntime depending on the sourced building block library.","default":0}},"type":"object","title":"BuildingBlockMetadata","description":"Metadata associated with a building block molecule."},"ReactionStep":{"properties":{"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\>]+$","title":"Smiles","description":"A single-step chemical reaction denoted using a SMILES\nrepresentation. Reactants are guaranteed to be either a\npurchasable building block or synthetically synthesizable\nmolecule."},"order":{"type":"integer","title":"Order","description":"Post-order position of the reaction step in the synthetic\nroute. Note that this field is not required to reproduce\nthe retrosynthesis pathway."}},"type":"object","required":["smiles","order"],"title":"ReactionStep","description":"A single-step reaction representing a synthesis step in a reaction tree."},"CursorPageMetadata":{"properties":{"has_next":{"type":"boolean","title":"Has Next","description":"Indicates if there is a next page of results. If true, the next set of\nresults can be fetched using `next_cursor` to populate the `after`\nfield in the next request, or requesting the next page.","default":false},"has_prev":{"type":"boolean","title":"Has Prev","description":"Indicates if there is a previous page of results. If true, the previous\nset of results can be fetched using `prev_cursor` to populate the\n`before` field in the next request, or requesting the previous page.","default":false},"next_cursor":{"anyOf":[{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"If provided, matches the cursor to be used for fetching the page of\nresults after the current one. See specific resource documentation for\ndetails on the sort order of results."},{"type":"null"}],"title":"Next Cursor"},"prev_cursor":{"anyOf":[{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"If provided, matches the cursor to be used for fetching the page of\nresults before the current one. See specific resource documentation for\ndetails on the sort order of results."},{"type":"null"}],"title":"Prev Cursor"}},"type":"object","title":"CursorPageMetadata","description":"Metadata that contains state information for cursor-based pages."},"PageLinks":{"properties":{"self":{"type":"string","maxLength":100000,"minLength":1,"title":"Self","description":"Relative URL path for the current page of results. This can be used to\nfetch the same page of results again from the API."},"next":{"anyOf":[{"type":"string","maxLength":100000,"minLength":1,"description":"Relative URL path for the next page of results. This can be used to\nfetch the next page of results from the API."},{"type":"null"}],"title":"Next"},"prev":{"anyOf":[{"type":"string","maxLength":100000,"minLength":1,"description":"Relative URL path for the previous page of results. This can be used to\nfetch the previous page of results from the API."},{"type":"null"}],"title":"Prev"}},"type":"object","required":["self"],"title":"PageLinks","description":"Links that contain information about the pagination state."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}/jobs":{"get":{"tags":["Batches"],"summary":"List a Batch's Jobs","description":"Retrieve a Batch's Job resources, with their routes, using cursor-based\npagination. Use the `metadata` and `links` fields to page through them.","operationId":"retrieve_batch_job_list_batches__batch_id__jobs_get","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"},{"description":"\n            An *optional* cursor used to indicate the item after which\n            results should be returned. When provided, results that come\n            after the specified cursor are returned. Cannot be used\n            together with the `before` parameter.\n\n            Note that results are returned in descending order so the\n            `after` cursor returns older items that appear in pages that\n            are *after* the current page.\n            ","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"After","description":"\n            An *optional* cursor used to indicate the item after which\n            results should be returned. When provided, results that come\n            after the specified cursor are returned. Cannot be used\n            together with the `before` parameter.\n\n            Note that results are returned in descending order so the\n            `after` cursor returns older items that appear in pages that\n            are *after* the current page.\n            "},"name":"after","in":"query"},{"description":"\n            An *optional* cursor used to indicate the item before which\n            results should be returned. When provided, results that come\n            before the specified cursor are returned. Cannot be used\n            together with the `after` parameter.\n\n            Note that results are returned in descending order so the\n            `before` cursor returns newer items that appear in pages\n            that are *before* the current page.\n            ","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before","description":"\n            An *optional* cursor used to indicate the item before which\n            results should be returned. When provided, results that come\n            before the specified cursor are returned. Cannot be used\n            together with the `after` parameter.\n\n            Note that results are returned in descending order so the\n            `before` cursor returns newer items that appear in pages\n            that are *before* the current page.\n            "},"name":"before","in":"query"},{"description":"\n                The **maximum** number of results to return for a single page\n                of items. The value can adversely affect offset-based pagination\n                when using the `page` parameter. Fewer results can be returned\n                than the value specified.\n                ","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"title":"Limit","description":"\n                The **maximum** number of results to return for a single page\n                of items. The value can adversely affect offset-based pagination\n                when using the `page` parameter. Fewer results can be returned\n                than the value specified.\n                ","default":25},"name":"limit","in":"query"},{"description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats."},"name":"accept-encoding","in":"header"}],"responses":{"200":{"description":"Returns a list of the Batch's Jobs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CursorPage_Job_"}}}},"400":{"description":"Malformed request data.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```

## Retrieve a Batch's Job

> Retrieve one of a Batch's Job resources by its ID, with its routes.

```json
{"openapi":"3.1.0","info":{"title":"Pending AI Retrosynthesis API","version":"v1.11.4"},"tags":[{"name":"Batches","description":"A high-throughput screening campaign for large-scale chemical libraries can be achieved through submitting *batches* of **Retrosynthesis** jobs with shared `parameters`. Pending AI offers batch sizes of up to 100,000 jobs which can be created and then appended to with additional API requests. Batch progress can be tracked with live updates to the number of completed jobs and a high-level screening overview can be retrieved.\nBatch synthesis jobs impact the overall queue size for a given engine. Larger batches may lead to a longer wait time for it to complete. Additional metadata data can also be added to the batch submission to help distinguish results beyond an arbitrary batch `id` field.\nSee [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability."}],"servers":[{"url":"https://api.pending.ai/retro/v2","description":"Pending AI API Server"}],"security":[{"oauth":[]},{"token":[]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"Pending AI OAuth2 authentication.","flows":{"authorizationCode":{"refreshUrl":"https://auth.pending.ai/oauth/token","scopes":{"openid":"Required for OpenID Connect sign-in","profile":"Access to the user's basic profile information","email":"Access to the user's email address","offline_access":"Request a refresh token"},"authorizationUrl":"https://auth.pending.ai/authorize","tokenUrl":"https://auth.pending.ai/oauth/token"}}},"token":{"type":"http","description":"Pending AI authentication access token.","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Job":{"properties":{"id":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Id","description":"Unique identifier for a resource."},"object":{"type":"string","maxLength":64,"minLength":1,"pattern":"^[A-Za-z_-]+$","title":"Object","description":"The named type for the resource.","default":"job"},"query":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","title":"Query","description":"A SMILES molecule to perform retrosynthesis on."},"status":{"$ref":"#/components/schemas/JobStatus","title":"Status","description":"The current status of the retrosynthesis job."},"created":{"type":"string","format":"date-time","title":"Created","description":"A timestamp for when the resource was created."},"updated":{"type":"string","format":"date-time","title":"Updated","description":"A timestamp for when the resource was last updated."},"parameters":{"$ref":"#/components/schemas/JobParameters","title":"Parameters"},"routes":{"items":{"$ref":"#/components/schemas/Route"},"type":"array","title":"Routes"},"query_is_building_block":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Query Is Building Block"},"ai_disclaimer":{"type":"string","maxLength":100000,"minLength":1,"title":"Ai Disclaimer","description":"Required EU AI Act compliance field. Provides a disclaimer about\nthe use of AI in generating retrosynthesis synthetic results.","default":"Pending AI's Retrosynthesis Engine is powered by artificial intelligence which is an experimental technology and may occasionally be misleading or incorrect."}},"type":"object","required":["id","query","status","parameters","routes"],"title":"Job","description":"A retrosynthesis Job for a single SMILES query molecule.\n\nJobs provide an interface for controlling the synthesis process and\nretrieving the detailed results from the retrosynthesis engine. The\nparameters provide more information about the job configuration."},"JobStatus":{"type":"string","enum":["submitted","processing","failed","completed"],"title":"JobStatus","description":"Job status enumeration."},"JobParameters":{"properties":{"retrosynthesis_engine":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","title":"Retrosynthesis Engine","description":"An ID belonging to a selected retrosynthesis engine to execute\nthe synthesis planning procedure. The value can be omitted to\nuse a default engine."},"building_block_libraries":{"items":{"type":"string","maxLength":128,"minLength":1,"pattern":"^[A-Za-z0-9_-]+$","description":"Unique identifier for a resource."},"type":"array","maxItems":100,"title":"Building Block Libraries","description":"The building block libraries the job's routes end in. Empty on a TwinOracle (`synth-`) engine, which prices its own building blocks."},"number_of_routes":{"type":"integer","maximum":50,"minimum":1,"title":"Number Of Routes","description":"The maximum number of routes to be generated during retrosynthesis\ncalculations. Found synthesis routes can be limited by the amount\nrequested, building block libraries, and other control parameters.","default":1},"processing_time":{"type":"integer","maximum":720,"minimum":60,"title":"Processing Time","description":"The maximum allowable processing time to complete retrosynthesis\nfor a target molecule. Calculations stop and exit once the time\nlimit is reached.","default":60},"reaction_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Reaction Limit","description":"The maximum number of times a single reaction step SMILES can\nappear within computed synthesis routes.","default":10},"building_block_limit":{"type":"integer","maximum":25,"minimum":1,"title":"Building Block Limit","description":"The maximum number of times a single SMILES building block can\nappear within computed synthesis routes.","default":10},"synth_options":{"anyOf":[{"$ref":"#/components/schemas/SynthOptions"},{"type":"null"}],"title":"Synth Options"}},"type":"object","required":["retrosynthesis_engine","building_block_libraries"],"title":"JobParameters","description":"Retrosynthesis procedure configuration parameters."},"SynthOptions":{"properties":{"max_price":{"type":"number","maximum":50000,"minimum":1,"title":"Max Price","description":"Leave out building blocks dearer than this, in USD per gram.","default":10000},"max_depth":{"type":"integer","maximum":20,"minimum":1,"title":"Max Depth","description":"Most steps a route may have.","default":12},"timeout":{"type":"integer","maximum":15,"minimum":2,"title":"Timeout","description":"Each search's time limit, in seconds.","default":10},"early_exit":{"type":"boolean","title":"Early Exit","description":"Stop each search at the first route.","default":true},"max_routes":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"title":"Max Routes","description":"Most routes to keep for each molecule; every route found if omitted. Different ways to make the molecule are kept before other building blocks for the same route."}},"type":"object","title":"SynthOptions","description":"TwinOracle (PAI Synth) search options, for a job or batch on a `synth-` engine.\n\nThe same options, with the same limits, as a single fast search in the web\napp (retro-api-webapp's `SynthOptions`, stored on each job as its camel-cased\n`synthOptions`). Ignored on a Mentor engine."},"Route":{"properties":{"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\>]+$","title":"Smiles","description":"A SMILES representation of a synthetically accessible\nretrosynthetic route reaction tree. Reactants are purchasable\nbuilding blocks, and the product is the target molecule."},"building_blocks":{"items":{"$ref":"#/components/schemas/BuildingBlock"},"type":"array","title":"Building Blocks"},"steps":{"items":{"$ref":"#/components/schemas/ReactionStep"},"type":"array","title":"Steps"},"stereocenters_mapped":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stereocenters Mapped","description":"Whether the target molecule's stereocentres were traced through\nevery reaction step of the route to its building blocks, so the\nroute makes the stereoisomer that was asked for. `null` when the\nretrosynthesis engine did not report it."}},"type":"object","required":["smiles","building_blocks","steps"],"title":"Route","description":"A retrosynthesis route computed using a retrosynthesis engine.\n\nContains a collection of building blocks and single-step reactions that represent\na complete synthesis route for a target molecule through individual reactions that\nbuild bottom-up to the target molecule."},"BuildingBlock":{"properties":{"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\]+$","title":"Smiles","description":"A SMILES representation of a building block."},"metadata":{"items":{"$ref":"#/components/schemas/BuildingBlockMetadata"},"type":"array","title":"Metadata"}},"type":"object","required":["smiles","metadata"],"title":"BuildingBlock","description":"A building block molecule represented by a SMILES structure."},"BuildingBlockMetadata":{"properties":{"identifier":{"type":"string","maxLength":100000,"minLength":1,"title":"Identifier","description":"An identifier used for annotating building block molecules.\nDifferent annotation styles can be used to distinguish against\ndataset providers.","default":"unknown"},"dataset_provider":{"type":"string","maxLength":100000,"minLength":1,"title":"Dataset Provider","description":"Name of the dataset provider that owns and distributes a specified\nbuilding block molecule.","default":"unknown"},"availability":{"type":"string","maxLength":100000,"minLength":1,"title":"Availability","description":"The availability status of the building block molecule. A\nmolecule is `in stock` if it is available for purchase and\n`unavailable` otherwise.","default":"unavailable"},"price":{"type":"number","title":"Price","description":"Price of the building block molecule for a specific\n`dataset_provider`. A molecule can have different prices\ndepending on the provider. Prices are subject to change over\ntime depending on the sourced building block library.","default":0}},"type":"object","title":"BuildingBlockMetadata","description":"Metadata associated with a building block molecule."},"ReactionStep":{"properties":{"smiles":{"type":"string","maxLength":10000,"minLength":1,"pattern":"^[A-Za-z0-9@\\.\\+\\-\\[\\]\\(\\)\\=:\\#\\%\\*\\$/\\\\>]+$","title":"Smiles","description":"A single-step chemical reaction denoted using a SMILES\nrepresentation. Reactants are guaranteed to be either a\npurchasable building block or synthetically synthesizable\nmolecule."},"order":{"type":"integer","title":"Order","description":"Post-order position of the reaction step in the synthetic\nroute. Note that this field is not required to reproduce\nthe retrosynthesis pathway."}},"type":"object","required":["smiles","order"],"title":"ReactionStep","description":"A single-step reaction representing a synthesis step in a reaction tree."},"BaseErrorContent":{"description":"An error occurred while handling the request. Refer to the `error` data for more information. For any further issues or enquiries about an error, contact support at [support@pending.ai](mailto:support@pending.ai) with details about your request including your `request_id`.","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/BaseErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Error","type":"object"},"BaseErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"default":null,"description":"Longer message describing an error wtih more information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorContent":{"description":"A request or response encountered a validation error when enforcing field constraints. Refer to `error.details` to resolve individual errors. For any unexpected validation errors, contact Pending AI support via email at [support@pending.ai](mailto:support@pending.ai).","properties":{"status":{"default":"error","description":"Status of the request.","enum":["error","success"],"title":"Request Status","type":"string"},"status_code":{"description":"Response status code received for the request.","title":"Status Code","type":"integer"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"default":null,"description":"A unique ID given to each request.","title":"Request ID"},"error":{"anyOf":[{"$ref":"#/components/schemas/RequestValidationErrorInfo"},{"type":"null"}],"default":null,"description":"Response content containing extra information for an error.","title":"Error Information"}},"required":["status_code"],"title":"Request Validation Error","type":"object"},"RequestValidationErrorInfo":{"description":"Response content containing extra information for an error.","properties":{"code":{"description":"Short identifier code to classify the error.","title":"Code","type":"string"},"timestamp":{"description":"Timestamp of when the error occurred.","format":"date-time","title":"Timestamp","type":"string"},"path":{"description":"Request path for where the error occurred.","title":"Request Path","type":"string"},"message":{"default":null,"description":"Message associated with the encountered error.","title":"Message"},"details":{"anyOf":[{"items":{"$ref":"#/components/schemas/RequestValidationErrorInfoDetails"},"type":"array"},{"type":"null"}],"default":null,"description":"Validation errors with extra information.","title":"Detailed Message"}},"required":["code","path"],"title":"Error Information","type":"object"},"RequestValidationErrorInfoDetails":{"description":"An individual validation error with extra information.","properties":{"location":{"default":null,"description":"One or more parameters for where the validation failed.","title":"Validation Location"},"error_type":{"default":null,"description":"A description of the validation constraint that was broken.","title":"Constraint Type"}},"title":"Detailed Error Content","type":"object"}}},"paths":{"/batches/{batch_id}/jobs/{job_id}":{"get":{"tags":["Batches"],"summary":"Retrieve a Batch's Job","description":"Retrieve one of a Batch's Job resources by its ID, with its routes.","operationId":"retrieve_batch_job_batches__batch_id__jobs__job_id__get","parameters":[{"description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Batch Id","description":"Unique identifier for a `Batch` object. The IDs\n        for objects are used to perform different operations."},"name":"batch_id","in":"path"},{"description":"Unique identifier for a `Job` object. The IDs\n        for objects are used to perform different operations.","required":true,"schema":{"type":"string","maxLength":128,"pattern":"^[A-Za-z0-9_-]+$","title":"Job Id","description":"Unique identifier for a `Job` object. The IDs\n        for objects are used to perform different operations."},"name":"job_id","in":"path"},{"description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"Providing a value for the header will request\n        that the response be converted into the specified format. If\n        omitted, the response will be in the default JSON format. Most\n        client libraries can automatically handle various compression\n        communication formats."},"name":"accept-encoding","in":"header"}],"responses":{"200":{"description":"Returns the Job","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Job"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","description":"Not `BaseErrorContent`: see the examples."}}}},"404":{"description":"Resource could not be found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BaseErrorContent"}}}},"422":{"description":"Request validation failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestValidationErrorContent"}}}}}}}}}
```
