> 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/building-block-libraries.md). Agents can also search and read this documentation through its [MCP server](https://docs.pending.ai/~gitbook/mcp).

# Building Block Libraries

Explore the various libraries available for retrosynthesis

For planning valid multi-step synthetic routes, various *building block libraries* are used to facilitate terminating different reaction subtrees. Our **Retrosynthesis** platform allows users to specify specific libraries for synthetic planning although it is recommended to select all libraries to improve the overall success rate. When submitting a query molecule for assessing synthetic accessibility, a list of libraries must be specified using respective `id` fields. **Considerations**

* Library selection can influence the success of the retrosynthesis process. It's important to choose libraries that are well-suited for the specific synthetic routes. - Some libraries may have limitations in terms of the reactions they can support or the average cost of available molecules. Use the latest libraries for optimal results (refer to the `available_from` field). See [here](https://docs.pending.ai/capabilities/synthetic-accessibility) for more information on our **Retrosynthesis** capability.

## List Libraries

> Retrieve a list of Library resources using offset-based pagination.\
> See the returned \`data\` field for more information about the Library\
> 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":"Libraries","description":"For planning valid multi-step synthetic routes, various *building block libraries* are used to facilitate terminating different reaction subtrees. Our **Retrosynthesis**  platform allows users to specify specific libraries for synthetic planning although it is recommended to select all libraries to improve the overall success rate. When  submitting a query molecule for assessing synthetic accessibility, a list of libraries  must be specified using respective `id` fields.\n**Considerations**\n- Library selection can influence the success of the retrosynthesis process. It's important to choose libraries that are well-suited for the specific synthetic routes. - Some libraries may have limitations in terms of the reactions they can support or the average cost of available molecules. Use the latest libraries for optimal results (refer to the `available_from` 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":{"OffsetPage_Library_":{"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/Library"},"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/OffsetPageMetadata","title":"Metadata"},"links":{"$ref":"#/components/schemas/PageLinks","title":"Links"}},"type":"object","required":["metadata","links"],"title":"OffsetPage[Library]"},"Library":{"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":"library"},"name":{"type":"string","maxLength":512,"minLength":1,"pattern":"^.*\\S.*$","title":"Name","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."},"version":{"type":"string","maxLength":100000,"minLength":1,"title":"Version","description":"Version of the library. Versions help track updates and changes to\nthe library content over time affecting the number of available\nbuilding blocks."},"available_from":{"type":"string","format":"date-time","title":"Available From","description":"The time when the library was made available. Older libraries may\ncontain out-of-date information or have changing price data. It is\nrecommended to use the latest libraries for optimal results."}},"type":"object","required":["id","name","version","available_from"],"title":"Library","description":"Libraries contain large collections of building blocks.\n\nThey can be used to construct synthetic routes. They contain\nadditional metadata such as source information and price to aid in\nreproducing the synthesis process. The selection of libraries\nimpacts the ability to resolve a retrosynthesis target meaning that\nwith more building block libraries selected when submitting a query\nmolecule, the chances of finding a viable synthetic route improves."},"OffsetPageMetadata":{"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},"total_items":{"anyOf":[{"type":"integer","description":"If provided, indicates the total number of items available across all\npages. This is useful for determining the page number and size when\niterating over all pages."},{"type":"null"}],"title":"Total Items"}},"type":"object","title":"OffsetPageMetadata","description":"Metadata that contains state information for offset-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."},"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":{"/libraries":{"get":{"tags":["Libraries"],"summary":"List Libraries","description":"Retrieve a list of Library resources using offset-based pagination.\nSee the returned `data` field for more information about the Library\nresources. Use additional `metadata` and `links` fields to navigate\nthe paginated resources.","operationId":"retrieve_library_list_libraries_get","parameters":[{"description":"The page number to retrieve.","required":false,"schema":{"type":"integer"},"name":"page","in":"query"},{"description":"The maximum number of items to return per page.","required":false,"schema":{"type":"integer"},"name":"limit","in":"query"}],"responses":{"200":{"description":"Returns a list of Libraries.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OffsetPage_Library_"}}}},"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"}}}}}}}}}
```
