--- title: "메시지 전송" slug: "datastream-postproduce" tags: ["Data Stream", "Produce"] updated: 2026-09-17T09:16:12Z published: 2026-09-17T09:16:12Z canonical: "api.ncloud-docs.com/datastream-postproduce" --- > ## Documentation Index > Fetch the complete documentation index at: https://api.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # 메시지 전송 VPC 환경에서 이용 가능합니다. 메시지(데이터)를 토픽으로 전송합니다. 전송 결과는 네이버 클라우드 플랫폼 콘솔의 Data Stream 서비스에서 **Topic** > **[데이터]** 탭 메뉴를 클릭하여 확인할 수 있습니다. 참고 - Apache Kafka 클러스터에 TCP 엔드포인트를 통해 연결하여 메시지를 생산하고 소비하는 방법은 Data Stream 사용 가이드를 참조해 주십시오. - 예제 코드 - [Java](https://guide.ncloud-docs.com/docs/datastream-java-example-vpc) - [Python](https://guide.ncloud-docs.com/docs/datastream-python-example-vpc) - [Logstash](https://guide.ncloud-docs.com/docs/datastream-logstash-example-vpc) - `STRING` 타입의 메시지 전송을 지원합니다. 그 외 데이터 타입의 메시지 전송은 추후 지원 예정입니다. ## 요청 요청 형식을 설명합니다. 요청 형식은 다음과 같습니다. | 메서드 | URI | | --- | --- | | POST | /api/produce | ### 요청 헤더 Data Stream API에서 공통으로 사용하는 헤더에 대한 정보는 [Data Stream 요청 헤더](/docs/datastream-overview#%EC%9A%94%EC%B2%AD%ED%97%A4%EB%8D%94)를 참조해 주십시오. 주의 보안을 위해 인증 시 네이버 클라우드 플랫폼 메인 계정의 Access Key, Secret Key를 사용할 수 없습니다. 따라서 서브 계정을 생성한 후 서브 계정의 Access Key, Secret Key를 사용해야 합니다. 서브 계정 생성 및 Access Key, Secret Key 확인 방법은 [Sub Account 사용 가이드](https://guide.ncloud-docs.com/docs/subaccount-overview)를 참조해 주십시오. ### 요청 바디 요청 바디에 대한 설명은 다음과 같습니다. | 필드 | 타입 | 필수 여부 | 설명 | | --- | --- | --- | --- | | `topic` | String | Required | 토픽 이름 - [토픽 목록 조회](/docs/datastream-gettopic) 참조 | | `key` | String | Required | 메시지 키 | | `value` | String | Required | 메시지 값(내용) | | `partition` | Number | Optional | 메시지 전송할 토픽 파티션 인덱스 - 미입력 시 임의의 파티션으로 전송 | ### 요청 예시 요청 예시는 다음과 같습니다. #### 파티션 미지정 파티션을 지정하지 않고 전송하는 경우의 요청 예시는 다음과 같습니다. ``` curl --location --request POST 'https://api.datastream.naverncp.com/api/produce' \ --header 'x-ncp-apigw-timestamp: {Timestamp}' \ --header 'x-ncp-iam-access-key: {Access Key}' \ --header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \ --data '{ "topic": "{TopicName}", "key": "test-key", "value": "this is a test (body)" }' ``` #### 파티션 지정 파티션을 지정하여 전송하는 경우의 요청 예시는 다음과 같습니다. ``` curl --location --request POST 'https://api.datastream.naverncp.com/api/produce' \ --header 'x-ncp-apigw-timestamp: {Timestamp}' \ --header 'x-ncp-iam-access-key: {Access Key}' \ --header 'x-ncp-apigw-signature-v2: {API Gateway Signature}' \ --data '{ "topic": "{TopicName}", "key": "test-key", "value": "this is a test (body)", "partition": 0 }' # 파티션 번호는 0번 부터 시작 ``` ## 응답 응답 형식을 설명합니다. ### 응답 바디 응답 바디에 대한 설명은 다음과 같습니다. | 필드 | 타입 | 필수 여부 | 설명 | | --- | --- | --- | --- | | `status` | Number | Required | [응답 상태 코드](/docs/datastream-postproduce#%EC%9D%91%EB%8B%B5%EC%83%81%ED%83%9C%EC%BD%94%EB%93%9C) | | `detail` | String | Required | [응답 상태 코드 메시지](/docs/datastream-postproduce#%EC%9D%91%EB%8B%B5%EC%83%81%ED%83%9C%EC%BD%94%EB%93%9C) | #### 응답 상태 코드 응답 상태 코드에 대한 설명은 다음과 같습니다. | HTTP 상태 코드 | 코드 | 메시지 | 설명 | | --- | --- | --- | --- | | 200 | - | OK | 요청 성공 | | 400 | - | Bad Request | 요청 또는 바디 값 등의 잘못된 요청 | | 400 | - | Bad Request, Invalid headers | 잘못된 헤더 요청 | | 400 | - | Bad Request, Invalid topic partition | 유효하지 않은 파티션 요청 | | 401 | - | Unauthorized | 인증 실패 | | 403 | - | Forbidden | 권한 없음 | | 500 | - | Internal Server Error | 처리되지 않는 오류 | ### 응답 예시 응답 예시는 다음과 같습니다. ``` { "status": "200", "detail" : "OK" } ```