@@ -85,6 +85,35 @@ export class Batches extends APIResource {
8585 } ) ;
8686 }
8787
88+ /**
89+ * This endpoint is idempotent and can be used to poll for Message Batch
90+ * completion. To access the results of a Message Batch, make a request to the
91+ * `results_url` field in the response.
92+ */
93+ delete (
94+ messageBatchId : string ,
95+ params ?: BatchDeleteParams ,
96+ options ?: Core . RequestOptions ,
97+ ) : Core . APIPromise < BetaDeletedMessageBatch > ;
98+ delete ( messageBatchId : string , options ?: Core . RequestOptions ) : Core . APIPromise < BetaDeletedMessageBatch > ;
99+ delete (
100+ messageBatchId : string ,
101+ params : BatchDeleteParams | Core . RequestOptions = { } ,
102+ options ?: Core . RequestOptions ,
103+ ) : Core . APIPromise < BetaDeletedMessageBatch > {
104+ if ( isRequestOptions ( params ) ) {
105+ return this . delete ( messageBatchId , { } , params ) ;
106+ }
107+ const { betas } = params ;
108+ return this . _client . delete ( `/v1/messages/batches/${ messageBatchId } ?beta=true` , {
109+ ...options ,
110+ headers : {
111+ 'anthropic-beta' : [ ...( betas ?? [ ] ) , 'message-batches-2024-09-24' ] . toString ( ) ,
112+ ...options ?. headers ,
113+ } ,
114+ } ) ;
115+ }
116+
88117 /**
89118 * Batches may be canceled any time before processing ends. Once cancellation is
90119 * initiated, the batch enters a `canceling` state, at which time the system may
@@ -155,6 +184,20 @@ export class Batches extends APIResource {
155184
156185export class BetaMessageBatchesPage extends Page < BetaMessageBatch > { }
157186
187+ export interface BetaDeletedMessageBatch {
188+ /**
189+ * ID of the Message Batch.
190+ */
191+ id : string ;
192+
193+ /**
194+ * Deleted object type.
195+ *
196+ * For Message Batches, this is always `"message_batch_deleted"`.
197+ */
198+ type : 'message_batch_deleted' ;
199+ }
200+
158201export interface BetaMessageBatch {
159202 /**
160203 * Unique object identifier.
@@ -628,6 +671,13 @@ export interface BatchListParams extends PageParams {
628671 betas ?: Array < BetaAPI . AnthropicBeta > ;
629672}
630673
674+ export interface BatchDeleteParams {
675+ /**
676+ * Optional header to specify the beta version(s) you want to use.
677+ */
678+ betas ?: Array < BetaAPI . AnthropicBeta > ;
679+ }
680+
631681export interface BatchCancelParams {
632682 /**
633683 * Optional header to specify the beta version(s) you want to use.
@@ -646,6 +696,7 @@ Batches.BetaMessageBatchesPage = BetaMessageBatchesPage;
646696
647697export declare namespace Batches {
648698 export {
699+ type BetaDeletedMessageBatch as BetaDeletedMessageBatch ,
649700 type BetaMessageBatch as BetaMessageBatch ,
650701 type BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult ,
651702 type BetaMessageBatchErroredResult as BetaMessageBatchErroredResult ,
@@ -658,6 +709,7 @@ export declare namespace Batches {
658709 type BatchCreateParams as BatchCreateParams ,
659710 type BatchRetrieveParams as BatchRetrieveParams ,
660711 type BatchListParams as BatchListParams ,
712+ type BatchDeleteParams as BatchDeleteParams ,
661713 type BatchCancelParams as BatchCancelParams ,
662714 type BatchResultsParams as BatchResultsParams ,
663715 } ;
0 commit comments