> 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-generator/sample-batches.md).

# Sample Batches

Generate up to 100,000 molecules in one request

A sample batch generates more molecules than a single sample can hold. `POST /samples` takes at most 500 molecules; a batch takes up to 100,000 and splits them into chunks of up to 500, which are generated independently in the background.

Creating a batch returns at once. Poll `GET /sample-batches/{batch_id}` until its `status` is `completed` or `failed`, then page through its chunks with `GET /sample-batches/{batch_id}/samples` to collect the molecules.

The team's plan must cover the whole batch when it's created, or the batch is refused with `402`.

## Retrieve a sample batch

> Retrieves a sample batch, including its live \`status\`, \`completed\_chunks\`, and \`failed\_chunks\`, computed from its chunks at request time.

````json
{"openapi":"3.1.0","info":{"title":"PAI Generator","version":"v0.0.104"},"tags":[{"name":"Sample Batches","description":"\nA sample batch generates more molecules than a single sample can hold. `POST /samples`\ntakes at most 500 molecules; a batch takes up to 100,000 and splits them into chunks of\nup to 500, which are generated independently in the background.\n\nCreating a batch returns at once. Poll `GET /sample-batches/{batch_id}` until its\n`status` is `completed` or `failed`, then page through its chunks with\n`GET /sample-batches/{batch_id}/samples` to collect the molecules.\n\nThe team's plan must cover the whole batch when it's created, or the batch is refused\nwith `402`.\n"}],"servers":[{"url":"https://api.pending.ai/generator/v1","description":"Pending AI API Server"}],"security":[{"oauth":[""]},{"token":[""]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"OAuth2 authentication.\n\nAuthenticate using the Pending AI [authorization server](https://auth.pending.ai/authorize) through an implicit OAuth2 flow. You will be redirected to a Pending AI login page to authenticate and authorize access to your account. After authorization, you will be redirected back to the original application with an access token. Ensure that the application is registered with Pending AI and/or that the correct redirect URI is configured. Contact Pending AI support for more information if the application is not registered.","flows":{"implicit":{"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","generator_api.models:create":"Create PAI Generator models","generator_api.models:read":"Read PAI Generator models","generator_api.models:update":"Update PAI Generator models","generator_api.models:delete":"Delete PAI Generator models","generator_api.samples:create":"Create PAI Generator samples","generator_api.samples:read":"Read PAI Generator samples","generator_api.samples:update":"Update PAI Generator samples","generator_api.samples:delete":"Delete PAI Generator samples"},"authorizationUrl":"https://auth.pending.ai/authorize"}}},"token":{"type":"http","description":"Bearer token authentication.\n\nProvide a valid Pending AI authentication token. Generating tokens can be done manually through the Pending AI CLI. Ensure you have an existing account or [register now](https://lab.pending.ai/).\n\n```bash\npendingai auth login\npendingai auth token\n```","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"SampleBatchResource":{"properties":{"id":{"type":"string","pattern":"^\\w+$","title":"Resource Id","description":"The unique resource identifier."},"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource."},"model_id":{"anyOf":[{"type":"string","pattern":"^\\w+$"},{"type":"null"}],"title":"Model Id","description":"An `id` belonging to the model used to generate every chunk in this\nbatch. `None` if no model was requested, in which case each chunk\nresolves its own model independently."},"size":{"type":"integer","maximum":100000,"minimum":1,"title":"Size","description":"The total number of sampled molecules requested for the batch."},"chunk_count":{"type":"integer","minimum":1,"title":"Chunk Count","description":"The number of independent chunks this batch was split into. Each\nchunk generates up to 500 molecules."},"chunks_created":{"type":"boolean","title":"Chunks Created","description":"Whether every chunk in this batch has been created and dispatched\nyet. `False` immediately after the batch is created; a background\nworker flips this to `True` once it finishes -- it does not mean the\nchunks have finished processing, only that they exist and have been\nqueued."},"status":{"type":"string","enum":["pending","processing","completed","failed"],"title":"Status","description":"The overall status of the batch, computed from its chunks: `pending`\nuntil every chunk has been created, `processing` once at least one\nchunk is created but not every chunk has reached a terminal state,\n`completed` once every chunk has completed successfully, or `failed`\nonce every chunk has reached a terminal state and at least one\nfailed."},"completed_chunks":{"type":"integer","minimum":0,"title":"Completed Chunks","description":"The number of chunks that have completed successfully so far."},"failed_chunks":{"type":"integer","minimum":0,"title":"Failed Chunks","description":"The number of chunks that have failed so far."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Timestamp for when the batch was created."}},"type":"object","required":["id","object","size","chunk_count","chunks_created","status","completed_chunks","failed_chunks"],"title":"SampleBatch","description":"A sample batch splits one large sampling request into\nindependently-processed chunks, each generating molecules from a\nmachine-learning model. Use the batch's samples to retrieve the\ngenerated structures once processing completes."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ResponseValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"ResponseValidationError"}}},"paths":{"/sample-batches/{batch_id}":{"get":{"tags":["Sample Batches"],"summary":"Retrieve a sample batch","description":"Retrieves a sample batch, including its live `status`, `completed_chunks`, and `failed_chunks`, computed from its chunks at request time.","operationId":"retrieve_batch_sample_batches__batch_id__get","parameters":[{"description":"A unique identifier for a sample batch resource.","required":true,"schema":{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$","title":"Batch Id","description":"A unique identifier for a sample batch resource."},"name":"batch_id","in":"path"},{"description":"An optional header to be provided when accepting Base64 compressed response content. Providing a value containing `gzip` yields gzipped Base64-encoded content for the response body.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"An optional header to be provided when accepting Base64 compressed response content. Providing a value containing `gzip` yields gzipped Base64-encoded content for the response body.","default":"*"},"name":"accept-encoding","in":"header"}],"responses":{"200":{"description":"Returns the sample batch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SampleBatchResource"}}}},"404":{"description":"Sample batch resource not found.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Response Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseValidationError"}}}}}}}}}
````

## Delete a sample batch

> Delete a sample batch. The batch stops appearing in \`list\`/\`retrieve\` immediately, but archiving its chunks happens in the background afterward.

````json
{"openapi":"3.1.0","info":{"title":"PAI Generator","version":"v0.0.104"},"tags":[{"name":"Sample Batches","description":"\nA sample batch generates more molecules than a single sample can hold. `POST /samples`\ntakes at most 500 molecules; a batch takes up to 100,000 and splits them into chunks of\nup to 500, which are generated independently in the background.\n\nCreating a batch returns at once. Poll `GET /sample-batches/{batch_id}` until its\n`status` is `completed` or `failed`, then page through its chunks with\n`GET /sample-batches/{batch_id}/samples` to collect the molecules.\n\nThe team's plan must cover the whole batch when it's created, or the batch is refused\nwith `402`.\n"}],"servers":[{"url":"https://api.pending.ai/generator/v1","description":"Pending AI API Server"}],"security":[{"oauth":[""]},{"token":[""]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"OAuth2 authentication.\n\nAuthenticate using the Pending AI [authorization server](https://auth.pending.ai/authorize) through an implicit OAuth2 flow. You will be redirected to a Pending AI login page to authenticate and authorize access to your account. After authorization, you will be redirected back to the original application with an access token. Ensure that the application is registered with Pending AI and/or that the correct redirect URI is configured. Contact Pending AI support for more information if the application is not registered.","flows":{"implicit":{"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","generator_api.models:create":"Create PAI Generator models","generator_api.models:read":"Read PAI Generator models","generator_api.models:update":"Update PAI Generator models","generator_api.models:delete":"Delete PAI Generator models","generator_api.samples:create":"Create PAI Generator samples","generator_api.samples:read":"Read PAI Generator samples","generator_api.samples:update":"Update PAI Generator samples","generator_api.samples:delete":"Delete PAI Generator samples"},"authorizationUrl":"https://auth.pending.ai/authorize"}}},"token":{"type":"http","description":"Bearer token authentication.\n\nProvide a valid Pending AI authentication token. Generating tokens can be done manually through the Pending AI CLI. Ensure you have an existing account or [register now](https://lab.pending.ai/).\n\n```bash\npendingai auth login\npendingai auth token\n```","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"DeleteOutput":{"properties":{"id":{"type":"string","pattern":"^\\w+$","title":"Resource Id","description":"The unique resource identifier."},"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource."},"deleted":{"type":"boolean","title":"Deleted","description":"Whether the batch was deleted.","default":true}},"type":"object","required":["id","object"],"title":"SampleBatchDeleteResult","description":"Deletion confirmation for a sample batch. The batch stops\nappearing in `list`/`retrieve` immediately, but archiving its\nchunks happens in the background afterward."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ResponseValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"ResponseValidationError"}}},"paths":{"/sample-batches/{batch_id}":{"delete":{"tags":["Sample Batches"],"summary":"Delete a sample batch","description":"Delete a sample batch. The batch stops appearing in `list`/`retrieve` immediately, but archiving its chunks happens in the background afterward.","operationId":"delete_batch_sample_batches__batch_id__delete","parameters":[{"description":"A unique identifier for a sample batch resource.","required":true,"schema":{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$","title":"Batch Id","description":"A unique identifier for a sample batch resource."},"name":"batch_id","in":"path"}],"responses":{"200":{"description":"Returns deletion confirmation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteOutput"}}}},"404":{"description":"Sample batch resource not found.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Response Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseValidationError"}}}}}}}}}
````

## List a sample batch's chunks

> Retrieve a page of the sample chunks belonging to a batch. Each item is a full sample resource, including its generated \`smiles\` once the chunk has completed.

````json
{"openapi":"3.1.0","info":{"title":"PAI Generator","version":"v0.0.104"},"tags":[{"name":"Sample Batches","description":"\nA sample batch generates more molecules than a single sample can hold. `POST /samples`\ntakes at most 500 molecules; a batch takes up to 100,000 and splits them into chunks of\nup to 500, which are generated independently in the background.\n\nCreating a batch returns at once. Poll `GET /sample-batches/{batch_id}` until its\n`status` is `completed` or `failed`, then page through its chunks with\n`GET /sample-batches/{batch_id}/samples` to collect the molecules.\n\nThe team's plan must cover the whole batch when it's created, or the batch is refused\nwith `402`.\n"}],"servers":[{"url":"https://api.pending.ai/generator/v1","description":"Pending AI API Server"}],"security":[{"oauth":[""]},{"token":[""]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"OAuth2 authentication.\n\nAuthenticate using the Pending AI [authorization server](https://auth.pending.ai/authorize) through an implicit OAuth2 flow. You will be redirected to a Pending AI login page to authenticate and authorize access to your account. After authorization, you will be redirected back to the original application with an access token. Ensure that the application is registered with Pending AI and/or that the correct redirect URI is configured. Contact Pending AI support for more information if the application is not registered.","flows":{"implicit":{"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","generator_api.models:create":"Create PAI Generator models","generator_api.models:read":"Read PAI Generator models","generator_api.models:update":"Update PAI Generator models","generator_api.models:delete":"Delete PAI Generator models","generator_api.samples:create":"Create PAI Generator samples","generator_api.samples:read":"Read PAI Generator samples","generator_api.samples:update":"Update PAI Generator samples","generator_api.samples:delete":"Delete PAI Generator samples"},"authorizationUrl":"https://auth.pending.ai/authorize"}}},"token":{"type":"http","description":"Bearer token authentication.\n\nProvide a valid Pending AI authentication token. Generating tokens can be done manually through the Pending AI CLI. Ensure you have an existing account or [register now](https://lab.pending.ai/).\n\n```bash\npendingai auth login\npendingai auth token\n```","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ResourceList_SampleResource_":{"properties":{"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/SampleResource"},"type":"array","title":"Data","description":"A list containing the retrieved objects. The list can contain fewer\nobjects than requested if a smaller number of results were found."},"has_more":{"type":"boolean","title":"Has More","description":"A boolean flag that indicates whether there are more items available\nto be fetched on subsequent pages. Used for pagination control."}},"type":"object","required":["data","has_more"],"title":"ResourceList[SampleResource]"},"SampleResource":{"properties":{"id":{"type":"string","pattern":"^\\w+$","title":"Resource Id","description":"The unique resource identifier."},"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource."},"model_id":{"anyOf":[{"type":"string","pattern":"^\\w+$"},{"type":"null"}],"title":"Model Id","description":"An `id` belonging to the model used to generate the sample. The\nvalue can be used to retrieve more information about the model.\n`None` only while a `SampleBatch` chunk is still `pending` and no\nmodel has been resolved for it yet."},"smiles":{"items":{"type":"string"},"type":"array","title":"Smiles","description":"A collection of generated SMILES structures from the model. The\nnumber of structures will correspond to the `num_samples` value\nprovided when creating the sample."},"status":{"type":"string","enum":["pending","processing","completed","failed"],"title":"Status","description":"The lifecycle status of the sample.","default":"completed"},"batch_id":{"anyOf":[{"type":"string","pattern":"^\\w+$"},{"type":"null"}],"title":"Batch Id","description":"The `id` of the `SampleBatch` this sample was created as a chunk of,\nif any. `None` for a sample created directly via `POST /samples`."},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error","description":"A short error message, set only when `status` is `failed`."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Timestamp for when the sample was created."}},"type":"object","required":["id","object","smiles"],"title":"Sample","description":"A sample contains a collection of molecules generated by a machine-\nlearning model on a defined chemical space. Samples represent the\nnovel structures in a SMILES format."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ResponseValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"ResponseValidationError"}}},"paths":{"/sample-batches/{batch_id}/samples":{"get":{"tags":["Sample Batches"],"summary":"List a sample batch's chunks","description":"Retrieve a page of the sample chunks belonging to a batch. Each item is a full sample resource, including its generated `smiles` once the chunk has completed.","operationId":"list_batch_samples_sample_batches__batch_id__samples_get","parameters":[{"description":"A unique identifier for a sample batch resource.","required":true,"schema":{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$","title":"Batch Id","description":"A unique identifier for a sample batch resource."},"name":"batch_id","in":"path"},{"description":"Limit the number of resources returned within the `data` field of the paged response. The field may contain fewer items than the specified limit when there are not enough items to return.","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"title":"Limit","description":"Limit the number of resources returned within the `data` field of the paged response. The field may contain fewer items than the specified limit when there are not enough items to return.","default":5},"name":"limit","in":"query"},{"description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the next 'page', or those that were submitted before the matched resource (reverse chronological order).","required":false,"schema":{"anyOf":[{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$"},{"type":"null"}],"title":"Next-Page","description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the next 'page', or those that were submitted before the matched resource (reverse chronological order)."},"name":"next-page","in":"query"},{"description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the previous 'page', or those that were submitted after the matched resource (reverse chronological order).","required":false,"schema":{"anyOf":[{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$"},{"type":"null"}],"title":"Prev-Page","description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the previous 'page', or those that were submitted after the matched resource (reverse chronological order)."},"name":"prev-page","in":"query"},{"description":"An optional header to be provided when accepting Base64 compressed response content. Providing a value containing `gzip` yields gzipped Base64-encoded content for the response body.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"An optional header to be provided when accepting Base64 compressed response content. Providing a value containing `gzip` yields gzipped Base64-encoded content for the response body.","default":"*"},"name":"accept-encoding","in":"header"}],"responses":{"200":{"description":"Returns a list of sample chunks.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceList_SampleResource_"}}}},"400":{"description":"Request contained invalid data.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"404":{"description":"Sample batch resource not found.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Response Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseValidationError"}}}}}}}}}
````

## List sample batches

> Retrieve a list of sample batches. Key-based pagination is supported. See query parameters for more details on how to retrieve the next or previous page of results.

````json
{"openapi":"3.1.0","info":{"title":"PAI Generator","version":"v0.0.104"},"tags":[{"name":"Sample Batches","description":"\nA sample batch generates more molecules than a single sample can hold. `POST /samples`\ntakes at most 500 molecules; a batch takes up to 100,000 and splits them into chunks of\nup to 500, which are generated independently in the background.\n\nCreating a batch returns at once. Poll `GET /sample-batches/{batch_id}` until its\n`status` is `completed` or `failed`, then page through its chunks with\n`GET /sample-batches/{batch_id}/samples` to collect the molecules.\n\nThe team's plan must cover the whole batch when it's created, or the batch is refused\nwith `402`.\n"}],"servers":[{"url":"https://api.pending.ai/generator/v1","description":"Pending AI API Server"}],"security":[{"oauth":[""]},{"token":[""]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"OAuth2 authentication.\n\nAuthenticate using the Pending AI [authorization server](https://auth.pending.ai/authorize) through an implicit OAuth2 flow. You will be redirected to a Pending AI login page to authenticate and authorize access to your account. After authorization, you will be redirected back to the original application with an access token. Ensure that the application is registered with Pending AI and/or that the correct redirect URI is configured. Contact Pending AI support for more information if the application is not registered.","flows":{"implicit":{"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","generator_api.models:create":"Create PAI Generator models","generator_api.models:read":"Read PAI Generator models","generator_api.models:update":"Update PAI Generator models","generator_api.models:delete":"Delete PAI Generator models","generator_api.samples:create":"Create PAI Generator samples","generator_api.samples:read":"Read PAI Generator samples","generator_api.samples:update":"Update PAI Generator samples","generator_api.samples:delete":"Delete PAI Generator samples"},"authorizationUrl":"https://auth.pending.ai/authorize"}}},"token":{"type":"http","description":"Bearer token authentication.\n\nProvide a valid Pending AI authentication token. Generating tokens can be done manually through the Pending AI CLI. Ensure you have an existing account or [register now](https://lab.pending.ai/).\n\n```bash\npendingai auth login\npendingai auth token\n```","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"generator_api__models__resource__ResourceList_SampleBatch__ListOutputItem_":{"properties":{"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource.","default":"list"},"data":{"items":{"$ref":"#/components/schemas/generator_api__models__sample_batches__SampleBatch__ListOutputItem"},"type":"array","title":"Data","description":"A list containing the retrieved objects. The list can contain fewer\nobjects than requested if a smaller number of results were found."},"has_more":{"type":"boolean","title":"Has More","description":"A boolean flag that indicates whether there are more items available\nto be fetched on subsequent pages. Used for pagination control."}},"type":"object","required":["data","has_more"],"title":"ResourceList[SampleBatch.ListOutputItem]"},"generator_api__models__sample_batches__SampleBatch__ListOutputItem":{"properties":{"id":{"type":"string","pattern":"^\\w+$","title":"Resource Id","description":"The unique resource identifier."},"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource."},"model_id":{"anyOf":[{"type":"string","pattern":"^\\w+$"},{"type":"null"}],"title":"Model Id","description":"An `id` belonging to the model used to generate every chunk in\nthis batch, if one was requested."},"size":{"type":"integer","maximum":100000,"minimum":1,"title":"Size","description":"The total number of sampled molecules requested for the batch."},"chunk_count":{"type":"integer","minimum":1,"title":"Chunk Count","description":"The number of independent chunks this batch was split into."},"chunks_created":{"type":"boolean","title":"Chunks Created","description":"Whether every chunk in this batch has been created and\ndispatched yet."},"status":{"type":"string","enum":["pending","processing","completed","failed"],"title":"Status","description":"The overall status of the batch, computed from its chunks as for\na retrieved batch.","default":"pending"},"completed_chunks":{"type":"integer","minimum":0,"title":"Completed Chunks","description":"The number of chunks that have completed successfully so far.","default":0},"failed_chunks":{"type":"integer","minimum":0,"title":"Failed Chunks","description":"The number of chunks that have failed so far.","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Timestamp for when the batch was created."}},"type":"object","required":["id","object","size","chunk_count","chunks_created"],"title":"SampleBatch","description":"A reduced representation of a sample batch for providing\nmetadata to allow for efficient listing, with its live status."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ResponseValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"ResponseValidationError"}}},"paths":{"/sample-batches":{"get":{"tags":["Sample Batches"],"summary":"List sample batches","description":"Retrieve a list of sample batches. Key-based pagination is supported. See query parameters for more details on how to retrieve the next or previous page of results.","operationId":"list_batches_sample_batches_get","parameters":[{"description":"Limit the number of resources returned within the `data` field of the paged response. The field may contain fewer items than the specified limit when there are not enough items to return.","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"title":"Limit","description":"Limit the number of resources returned within the `data` field of the paged response. The field may contain fewer items than the specified limit when there are not enough items to return.","default":5},"name":"limit","in":"query"},{"description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the next 'page', or those that were submitted before the matched resource (reverse chronological order).","required":false,"schema":{"anyOf":[{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$"},{"type":"null"}],"title":"Next-Page","description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the next 'page', or those that were submitted before the matched resource (reverse chronological order)."},"name":"next-page","in":"query"},{"description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the previous 'page', or those that were submitted after the matched resource (reverse chronological order).","required":false,"schema":{"anyOf":[{"type":"string","maxLength":255,"minLength":1,"pattern":"^\\w+$"},{"type":"null"}],"title":"Prev-Page","description":"A key used to navigate pagination results. The given value must match an `id` for the specific resource `object` type. If provided, the paged response will contain resources from the previous 'page', or those that were submitted after the matched resource (reverse chronological order)."},"name":"prev-page","in":"query"}],"responses":{"200":{"description":"Returns a list of sample batches.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/generator_api__models__resource__ResourceList_SampleBatch__ListOutputItem_"}}}},"400":{"description":"Request contained invalid data.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Response Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseValidationError"}}}}}}}}}
````

## Create a sample batch

> Create a sample batch by splitting one large sampling request into independently-processed chunks. Chunk creation and processing happen asynchronously -- the returned batch has \`chunks\_created=False\` until every chunk has been created and dispatched.

````json
{"openapi":"3.1.0","info":{"title":"PAI Generator","version":"v0.0.104"},"tags":[{"name":"Sample Batches","description":"\nA sample batch generates more molecules than a single sample can hold. `POST /samples`\ntakes at most 500 molecules; a batch takes up to 100,000 and splits them into chunks of\nup to 500, which are generated independently in the background.\n\nCreating a batch returns at once. Poll `GET /sample-batches/{batch_id}` until its\n`status` is `completed` or `failed`, then page through its chunks with\n`GET /sample-batches/{batch_id}/samples` to collect the molecules.\n\nThe team's plan must cover the whole batch when it's created, or the batch is refused\nwith `402`.\n"}],"servers":[{"url":"https://api.pending.ai/generator/v1","description":"Pending AI API Server"}],"security":[{"oauth":[""]},{"token":[""]}],"components":{"securitySchemes":{"oauth":{"type":"oauth2","description":"OAuth2 authentication.\n\nAuthenticate using the Pending AI [authorization server](https://auth.pending.ai/authorize) through an implicit OAuth2 flow. You will be redirected to a Pending AI login page to authenticate and authorize access to your account. After authorization, you will be redirected back to the original application with an access token. Ensure that the application is registered with Pending AI and/or that the correct redirect URI is configured. Contact Pending AI support for more information if the application is not registered.","flows":{"implicit":{"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","generator_api.models:create":"Create PAI Generator models","generator_api.models:read":"Read PAI Generator models","generator_api.models:update":"Update PAI Generator models","generator_api.models:delete":"Delete PAI Generator models","generator_api.samples:create":"Create PAI Generator samples","generator_api.samples:read":"Read PAI Generator samples","generator_api.samples:update":"Update PAI Generator samples","generator_api.samples:delete":"Delete PAI Generator samples"},"authorizationUrl":"https://auth.pending.ai/authorize"}}},"token":{"type":"http","description":"Bearer token authentication.\n\nProvide a valid Pending AI authentication token. Generating tokens can be done manually through the Pending AI CLI. Ensure you have an existing account or [register now](https://lab.pending.ai/).\n\n```bash\npendingai auth login\npendingai auth token\n```","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"generator_api__models__sample_batches__SampleBatch__CreateParams":{"properties":{"model_id":{"anyOf":[{"type":"string","pattern":"^\\w+$"},{"type":"null"}],"title":"Model Id","description":"Optional `id` belonging to a model to use for generating every\nchunk in the batch. If no model is provided, each chunk will\nindependently use any model that is readily available."},"size":{"type":"integer","maximum":100000,"minimum":1,"title":"Size","description":"The total number of sampled molecules to generate for the\nbatch. Split server-side into independent chunks of up to 500\nmolecules each."}},"type":"object","required":["size"],"title":"SampleBatchCreateParams","description":"Request data for creating a new sample batch."},"SampleBatchResource":{"properties":{"id":{"type":"string","pattern":"^\\w+$","title":"Resource Id","description":"The unique resource identifier."},"object":{"type":"string","pattern":"^\\w+$","title":"Resource Object","description":"The type of resource."},"model_id":{"anyOf":[{"type":"string","pattern":"^\\w+$"},{"type":"null"}],"title":"Model Id","description":"An `id` belonging to the model used to generate every chunk in this\nbatch. `None` if no model was requested, in which case each chunk\nresolves its own model independently."},"size":{"type":"integer","maximum":100000,"minimum":1,"title":"Size","description":"The total number of sampled molecules requested for the batch."},"chunk_count":{"type":"integer","minimum":1,"title":"Chunk Count","description":"The number of independent chunks this batch was split into. Each\nchunk generates up to 500 molecules."},"chunks_created":{"type":"boolean","title":"Chunks Created","description":"Whether every chunk in this batch has been created and dispatched\nyet. `False` immediately after the batch is created; a background\nworker flips this to `True` once it finishes -- it does not mean the\nchunks have finished processing, only that they exist and have been\nqueued."},"status":{"type":"string","enum":["pending","processing","completed","failed"],"title":"Status","description":"The overall status of the batch, computed from its chunks: `pending`\nuntil every chunk has been created, `processing` once at least one\nchunk is created but not every chunk has reached a terminal state,\n`completed` once every chunk has completed successfully, or `failed`\nonce every chunk has reached a terminal state and at least one\nfailed."},"completed_chunks":{"type":"integer","minimum":0,"title":"Completed Chunks","description":"The number of chunks that have completed successfully so far."},"failed_chunks":{"type":"integer","minimum":0,"title":"Failed Chunks","description":"The number of chunks that have failed so far."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Timestamp for when the batch was created."}},"type":"object","required":["id","object","size","chunk_count","chunks_created","status","completed_chunks","failed_chunks"],"title":"SampleBatch","description":"A sample batch splits one large sampling request into\nindependently-processed chunks, each generating molecules from a\nmachine-learning model. Use the batch's samples to retrieve the\ngenerated structures once processing completes."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ResponseValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"ResponseValidationError"}}},"paths":{"/sample-batches":{"post":{"tags":["Sample Batches"],"summary":"Create a sample batch","description":"Create a sample batch by splitting one large sampling request into independently-processed chunks. Chunk creation and processing happen asynchronously -- the returned batch has `chunks_created=False` until every chunk has been created and dispatched.","operationId":"create_batch_sample_batches_post","parameters":[{"description":"An optional header to be provided when accepting Base64 compressed response content. Providing a value containing `gzip` yields gzipped Base64-encoded content for the response body.","required":false,"schema":{"anyOf":[{"type":"string"},{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Accept-Encoding","description":"An optional header to be provided when accepting Base64 compressed response content. Providing a value containing `gzip` yields gzipped Base64-encoded content for the response body.","default":"*"},"name":"accept-encoding","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/generator_api__models__sample_batches__SampleBatch__CreateParams"}}},"required":true},"responses":{"200":{"description":"Returns the sample batch.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SampleBatchResource"}}}},"400":{"description":"Request contained invalid data.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"402":{"description":"The team has no plan, or can't generate that many molecules this billing period. The whole batch is refused.","content":{"application/json":{"schema":{"type":"null","title":"Return"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}},"500":{"description":"Response Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResponseValidationError"}}}}}}}}}
````
