> ## Documentation Index
> Fetch the complete documentation index at: https://x-preview-mintlify-d5730eee.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 소개

> X API의 Articles 엔드포인트로 리치 텍스트, 이미지, 동영상, 임베드 게시물, 링크를 포함한 장문 게시물의 초안을 프로그래밍 방식으로 작성하고 편집한 뒤, OAuth로 인증된 사용자 계정으로 X에 게시하는 전체 과정을 안내합니다.

Articles 엔드포인트를 사용하면 개발자는 X에서 프로그래밍 방식으로 draft Articles를 생성하고 게시할 수 있습니다. Articles는 서식 있는 텍스트, 임베드된 게시물, 링크, 이미지를 지원하는 장문 형식의 게시물입니다.

이러한 엔드포인트는 `tweet.read`, `tweet.write`, `users.read` 스코프를 사용하는 OAuth 1.0a 또는 OAuth 2.0 PKCE를 통한 사용자 인증이 필요합니다.

현재 API는 두 가지 엔드포인트를 지원합니다.

## draft Article 생성

개발자는 `POST https://api.x.com/2/articles/draft` 엔드포인트를 사용하여 새 draft Article을 생성할 수 있습니다. 요청 본문에는 article 제목, 텍스트 블록과 엔티티로 구성된 [DraftJS](https://draftjs.org/docs/api-reference-content-state) 콘텐츠 상태의 본문 콘텐츠, 그리고 선택적으로 [미디어 업로드 엔드포인트](/x-api/media/introduction)를 통해 업로드한 커버 미디어가 포함됩니다.

## Article 게시

draft가 준비되면 개발자는 `POST https://api.x.com/2/articles/{article_id}/publish` 엔드포인트를 사용하여 공개적으로 게시할 수 있으며, 여기서 `article_id`는 draft를 생성할 때 반환된 ID입니다.

## 시작하기

이 엔드포인트를 사용하려면 사용자 액세스 토큰이 필요합니다. 생성 방법에 대한 자세한 내용은 [PKCE를 사용한 OAuth 2.0 Authorization Code 흐름](/fundamentals/authentication/oauth-2-0/authorization-code) 문서를 참조하세요.

액세스 토큰이 있으면 아래와 같이 draft Article을 생성할 수 있습니다.

```bash theme={null}
curl --request POST 'https://api.x.com/2/articles/draft' \
  --header 'Authorization: Bearer XXXXX' \
  --header 'Content-Type: application/json' \
  --data '{
    "title": "My first Article",
    "content_state": {
      "blocks": [
        {
          "text": "Hello from the Articles API!",
          "type": "unstyled"
        }
      ],
      "entities": []
    }
  }'
```

요청이 성공하면 아래와 같은 JSON 응답을 확인할 수 있습니다.

```json theme={null}
{
  "data": {
    "id": "1146654567674912769",
    "title": "My first Article"
  }
}
```

그런 다음 반환된 Article ID를 사용하여 draft를 게시할 수 있습니다.

```bash theme={null}
curl --request POST 'https://api.x.com/2/articles/1146654567674912769/publish' \
  --header 'Authorization: Bearer XXXXX'
```

요청이 성공하면 응답에는 게시된 Article에 대해 생성된 게시물의 ID가 포함됩니다.

```json theme={null}
{
  "data": {
    "post_id": "1346889436626259968"
  }
}
```
