Claude Platform Docs

배치

메시지 배치 생성
$client->beta->messages->batches->create(list<Request> requests, ?list<AnthropicBeta> betas, ?string userProfileID, ?string workspaceID): MessageBatch
POST/v1/messages/batches

메시지 생성 요청의 배치를 전송합니다.

메시지 배치 조회
$client->beta->messages->batches->retrieve(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): MessageBatch
GET/v1/messages/batches/{message_batch_id}

이 엔드포인트는 멱등성(idempotent)을 가지며 메시지 배치 완료 여부를 폴링하는 데 사용할 수 있습니다. 메시지 배치의 결과에 액세스하려면 응답의 results_url 필드로 요청을 보내세요.

메시지 배치 목록 조회
$client->beta->messages->batches->list(?string afterID, ?string beforeID, ?int limit, ?list<AnthropicBeta> betas, ?string workspaceID): Page<MessageBatch>
GET/v1/messages/batches

워크스페이스 내의 모든 메시지 배치를 나열합니다. 가장 최근에 생성된 배치가 먼저 반환됩니다.

메시지 배치 취소
$client->beta->messages->batches->cancel(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): MessageBatch
POST/v1/messages/batches/{message_batch_id}/cancel

배치는 처리가 종료되기 전까지 언제든지 취소할 수 있습니다. 취소가 시작되면 배치는 canceling 상태로 전환되며, 이 시점에서 시스템은 취소를 최종 완료하기 전에 진행 중이며 중단할 수 없는 요청을 먼저 완료할 수 있습니다.

메시지 배치 삭제
$client->beta->messages->batches->delete(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): DeletedMessageBatch
DELETE/v1/messages/batches/{message_batch_id}

메시지 배치를 삭제합니다.

메시지 배치 결과 조회
$client->beta->messages->batches->results(string messageBatchID, ?list<AnthropicBeta> betas, ?string workspaceID): MessageBatchIndividualResponse
GET/v1/messages/batches/{message_batch_id}/results

메시지 배치의 결과를 .jsonl 파일로 스트리밍합니다.

Models
class DeletedMessageBatch { $type = 'message_batch_deleted'; $id; }
"message_batch_deleted" type

Deleted object type.

For Message Batches, this is always "message_batch_deleted".

string id

ID of the Message Batch.

class MessageBatch { $type = 'message_batch'; $id; $archivedAt; /* 7 more */ }
"message_batch" type

Object type.

For Message Batches, this is always "message_batch".

string id

Unique object identifier.

The format and length of IDs may change over time.

?\Datetime archivedAt

RFC 3339 datetime string representing the time at which the Message Batch was archived and its results became unavailable.

?\Datetime cancelInitiatedAt

RFC 3339 datetime string representing the time at which cancellation was initiated for the Message Batch. Specified only if cancellation was initiated.

\Datetime createdAt

RFC 3339 datetime string representing the time at which the Message Batch was created.

?\Datetime endedAt

RFC 3339 datetime string representing the time at which processing for the Message Batch ended. Specified only once processing ends.

Processing ends when every request in a Message Batch has either succeeded, errored, canceled, or expired.

\Datetime expiresAt

RFC 3339 datetime string representing the time at which the Message Batch will expire and end processing, which is 24 hours after creation.

ProcessingStatus processingStatus

Processing status of the Message Batch.

MessageBatchRequestCounts requestCounts

Tallies requests within the Message Batch, categorized by their status.

Requests start as processing and move to one of the other statuses only once processing of the entire batch ends. The sum of all values always matches the total number of requests in the batch.

?string resultsURL

URL to a .jsonl file containing the results of the Message Batch requests. Specified only once processing ends.

Results in the file are not guaranteed to be in the same order as requests. Use the custom_id field to match results to requests.

class MessageBatchCanceledResult { $type = 'canceled'; }
"canceled" type
class MessageBatchErroredResult { $type = 'errored'; $error; }
"errored" type
class MessageBatchExpiredResult { $type = 'expired'; }
"expired" type
class MessageBatchIndividualResponse { $customID; $result; }
string customID

Developer-provided ID created for each request in a Message Batch. Useful for matching results to requests, as results may be given out of request order.

Must be unique for each request within the Message Batch.

Processing result for this request.

Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.

class MessageBatchRequestCounts { $canceled; $errored; $expired; /* 2 more */ }
int canceled

Number of requests in the Message Batch that have been canceled.

This is zero until processing of the entire Message Batch has ended.

int errored

Number of requests in the Message Batch that encountered an error.

This is zero until processing of the entire Message Batch has ended.

int expired

Number of requests in the Message Batch that have expired.

This is zero until processing of the entire Message Batch has ended.

int processing

Number of requests in the Message Batch that are processing.

int succeeded

Number of requests in the Message Batch that have completed successfully.

This is zero until processing of the entire Message Batch has ended.

One of the following:
class MessageBatchSucceededResult { $type = 'succeeded'; $message; }
"succeeded" type
BetaMessage message