유용한 도구
Postman
코드 샘플
서드파티 라이브러리
핵심 개념
인증
개발자 콘솔, 프로젝트, 그리고 개발자 App
요청 한도
소스 라벨
프로필 설정
게시물에 미디어 추가하기
코드 예제
게시물 생성
cURL
답글 작성하기
cURL
게시물 삭제
cURL
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
curl -X POST "https://api.x.com/2/tweets" \
-H "Authorization: OAuth ..." \
-H "Content-Type: application/json" \
-d '{"text": "Hello world!"}'
from xdk import Client
from xdk.oauth1_auth import OAuth1
oauth1 = OAuth1(
api_key="YOUR_API_KEY",
api_secret="YOUR_API_SECRET",
access_token="YOUR_ACCESS_TOKEN",
access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
)
client = Client(auth=oauth1)
# 게시물 생성
response = client.posts.create(text="Hello world!")
print(f"Created Post: {response.data.id}")
import { Client, OAuth1 } from "@xdevplatform/xdk";
const oauth1 = new OAuth1({
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_API_SECRET",
accessToken: "YOUR_ACCESS_TOKEN",
accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
});
const client = new Client({ oauth1 });
// 게시물 생성
const response = await client.posts.create({ text: "Hello world!" });
console.log(`Created Post: ${response.data?.id}`);
curl -X POST "https://api.x.com/2/tweets" \
-H "Authorization: OAuth ..." \
-H "Content-Type: application/json" \
-d '{"text": "This is a reply!", "reply": {"in_reply_to_tweet_id": "1234567890"}}'
from xdk import Client
from xdk.oauth1_auth import OAuth1
oauth1 = OAuth1(
api_key="YOUR_API_KEY",
api_secret="YOUR_API_SECRET",
access_token="YOUR_ACCESS_TOKEN",
access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
)
client = Client(auth=oauth1)
# 답글 작성
response = client.posts.create(
text="This is a reply!",
reply={"in_reply_to_tweet_id": "1234567890"}
)
print(f"Created reply: {response.data.id}")
import { Client, OAuth1 } from "@xdevplatform/xdk";
const oauth1 = new OAuth1({
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_API_SECRET",
accessToken: "YOUR_ACCESS_TOKEN",
accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
});
const client = new Client({ oauth1 });
// 답글 작성
const response = await client.posts.create({
text: "This is a reply!",
reply: { inReplyToTweetId: "1234567890" },
});
console.log(`Created reply: ${response.data?.id}`);
curl -X DELETE "https://api.x.com/2/tweets/1234567890" \
-H "Authorization: OAuth ..."
from xdk import Client
from xdk.oauth1_auth import OAuth1
oauth1 = OAuth1(
api_key="YOUR_API_KEY",
api_secret="YOUR_API_SECRET",
access_token="YOUR_ACCESS_TOKEN",
access_token_secret="YOUR_ACCESS_TOKEN_SECRET"
)
client = Client(auth=oauth1)
# 게시물 삭제
response = client.posts.delete("1234567890")
print(f"Deleted: {response.data.deleted}")
import { Client, OAuth1 } from "@xdevplatform/xdk";
const oauth1 = new OAuth1({
apiKey: "YOUR_API_KEY",
apiSecret: "YOUR_API_SECRET",
accessToken: "YOUR_ACCESS_TOKEN",
accessTokenSecret: "YOUR_ACCESS_TOKEN_SECRET",
});
const client = new Client({ oauth1 });
// 게시물 삭제
const response = await client.posts.delete("1234567890");
console.log(`Deleted: ${response.data?.deleted}`);