Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Data Streams
  • Access management
  • Pricing policy
    • Overview
    • All methods
      • CreateStream
      • DecreaseStreamRetentionPeriod
      • DeleteStream
      • DescribeStream
      • IncreaseStreamRetentionPeriod
      • GetRecords
      • GetShardIterator
      • ListStreams
      • PutRecord
      • PutRecords
      • UpdateShardCount
    • Common errors
    • Examples
  • FAQ

In this article:

  • Request
  • Request parameters
  • Response
  • Response parameters
  • Errors
  1. Amazon Kinesis Data Streams compatible HTTP API
  2. Methods
  3. PutRecords

PutRecords

Written by
Yandex Cloud
Updated at February 20, 2023
  • Request
    • Request parameters
  • Response
    • Response parameters
  • Errors

Puts multiple messages into a stream per call.

The method provides greater performance as compared to PutRecord. Up to 500 messages can be sent in a single request. Each message in the request can be up to 1 MB in size. The entire request can't exceed 5 MB, including shard keys.

The request specifies the stream name and the Records array of messages. For each element of the array, a shard key and an object with Base64-encoded user data are specified. To explicitly set the hash key of the shard to write messages to, use the ExplicitHashKey parameter.

Returns an array of elements with data about written messages. Each element of the array returned corresponds to an element of the array sent. The elements in both arrays are ordered the same way. The returned array includes data from both successfully and unsuccessfully processed messages. Failure to write any message does not stop the processing of subsequent messages.

PutRecords ensures that messages will be written in the same order as in the sent array.

Data about a successfully processed message contains the ShardId indicating the shard that the message was written to and the message number (SequenceNumber).

Data about a message that the service failed to process contains the ErrorCode and ErrorMessage. Possible error types: ProvisionedThroughputExceededException or InternalFailure. If the type is ProvisionedThroughputExceededException, the error message contains the account ID, the stream name, and the shard ID of the message that couldn't be processed.

RequestRequest

The request contains data in JSON format.

{
  "Records": [{
    "Data": blob,
    "ExplicitHashKey": "string",
    "PartitionKey": "string"
  }],
  "StreamName": "string"
}

Request parametersRequest parameters

Parameter Description
Records Messages to write.

Type Array of objects PutRecordsRequestEntry
Number of elements: 1-500
Required: Yes
StreamName The name of the stream.

Type: String
Size: 1-128 characters.
Possible values: [a-zA-Z][a-zA-Z0-9-]+*(?<!-)$
Required: Yes

ResponseResponse

If successful, HTTP code 200 and data in JSON format are returned.

{
  "EncryptionType": "string",
  "FailedRecordCount": number,
  "Records": [{
    "ErrorCode": "string",
    "ErrorMessage": "string",
    "SequenceNumber": "string",
    "ShardId": "string"
  }]
}

Response parametersResponse parameters

Parameter Description
EncryptionType The type of encryption.

Type: String
Possible values: NONE
Required: Yes
FailedRecordCount The number of unprocessed messages.
Records The results of message processing.

Type Array of objects PutRecordsRequestEntry
Number of elements: 1-500
Required: Yes

ErrorsErrors

Parameter Description HTTP code
InvalidArgumentException The argument is invalid. For more information, see the error message. 400
ResourceNotFoundException The requested resource was not found. 400

Errors that are common to all methods may occur.

Was the article helpful?

Previous
PutRecord
Next
UpdateShardCount
Yandex project
© 2025 Yandex.Cloud LLC