@@ -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
@@ -168,6 +197,20 @@ export class Batches extends APIResource {
168197
169198export class BetaMessageBatchesPage extends Page < BetaMessageBatch > { }
170199
200+ export interface BetaDeletedMessageBatch {
201+ /**
202+ * ID of the Message Batch.
203+ */
204+ id : string ;
205+
206+ /**
207+ * Deleted object type.
208+ *
209+ * For Message Batches, this is always `"message_batch_deleted"`.
210+ */
211+ type : 'message_batch_deleted' ;
212+ }
213+
171214export interface BetaMessageBatch {
172215 /**
173216 * Unique object identifier.
@@ -374,6 +417,13 @@ export interface BatchListParams extends PageParams {
374417 betas ?: Array < BetaAPI . AnthropicBeta > ;
375418}
376419
420+ export interface BatchDeleteParams {
421+ /**
422+ * Optional header to specify the beta version(s) you want to use.
423+ */
424+ betas ?: Array < BetaAPI . AnthropicBeta > ;
425+ }
426+
377427export interface BatchCancelParams {
378428 /**
379429 * Optional header to specify the beta version(s) you want to use.
@@ -392,6 +442,7 @@ Batches.BetaMessageBatchesPage = BetaMessageBatchesPage;
392442
393443export declare namespace Batches {
394444 export {
445+ type BetaDeletedMessageBatch as BetaDeletedMessageBatch ,
395446 type BetaMessageBatch as BetaMessageBatch ,
396447 type BetaMessageBatchCanceledResult as BetaMessageBatchCanceledResult ,
397448 type BetaMessageBatchErroredResult as BetaMessageBatchErroredResult ,
@@ -404,6 +455,7 @@ export declare namespace Batches {
404455 type BatchCreateParams as BatchCreateParams ,
405456 type BatchRetrieveParams as BatchRetrieveParams ,
406457 type BatchListParams as BatchListParams ,
458+ type BatchDeleteParams as BatchDeleteParams ,
407459 type BatchCancelParams as BatchCancelParams ,
408460 type BatchResultsParams as BatchResultsParams ,
409461 } ;
0 commit comments