> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Reddit API

> Reddit API を使用した投稿のオプション

export const HeaderAPI = ({noProfileKey, profileKeyRequired}) => <>
    <ParamField header="Authorization" type="string" required>
      <a href="/apis/overview#authorization">API Key</a> of the Primary Profile.
      <br />
      <br />
      Format: <code>Authorization: Bearer API_KEY</code>
    </ParamField>
    {!noProfileKey && (profileKeyRequired ? <ParamField header="Profile-Key" type="string" required>
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField> : <ParamField header="Profile-Key" type="string">
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField>)}
  </>;

## Reddit への投稿

Reddit API を使用して投稿するには、以下のボディパラメーターが必要です。サブレディットが自動投稿を許可していることを確認してください。
詳細については [Reddit Media Guidelines](/media-guidelines/reddit) と [Reddit Authorization](/dashboard/connect-social-accounts/reddit) を参照してください。

```json Reddit Post theme={"system"}
{
  "post": "Reddit post", // empty string is allowed
  "platforms": ["reddit"], // required
  "redditOptions": {
    "title": "Reddit Post Title", // required
    "subreddit": "test", // required (no "/r/" needed)
    "link": "https://www.website.com" // optional: post a link
  }
}
```

<ul class="custom-bullets">
  <li>`title` (必須): Reddit の投稿タイトル。</li>

  <li>
    `subreddit` (必須): 投稿を送信するサブレディット。サブレディットの投稿ガイドラインに従っていることを確認してください。テストに使用できる優れたサブレディットは */r/test/* で、次のリンクから閲覧できます: [https://www.reddit.com/r/test/](https://www.reddit.com/r/test/)
  </li>

  <li>
    `link` (オプション): Reddit に投稿し、サブレディットにテキストではなくリンクを投稿したい場合。`post` パラメーターのテキストは依然として必須ですが、Reddit のリンクはテキスト本文を持てないため、投稿には含まれません。
  </li>
</ul>

<Warning>
  投稿前に必ずサブレディットのルールを確認してください。一部のサブレディットには karma のしきい値があったり、一定期間のメンバーシップを要求したり、投稿頻度を制限したり、画像を許可しなかったり、フレアの追加を要求したりします。また、ほとんどのサブレディットにはスパムや自己宣伝に関する特定のルールがあります。これらのルールに従わない場合、サブレディットまたは Reddit によってバンされる可能性があります。
</Warning>

## Reddit に画像を投稿する

画像 URL を `mediaUrl` パラメーターまたは `redditOptions` の `link` パラメーターに含めることで、Reddit に画像を投稿します。`link` として投稿された画像はフルサイズの画像に解決されます。

`post` パラメーターのテキストは無視されますが、投稿を正常に送信するために依然として必要です。Reddit では、画像とテキストを一緒に投稿することは、彼らのオンライン "fancy pants" エディターに制限されています。つまり、画像またはテキストのいずれかを投稿できますが、同時に両方を投稿することはできません。

```json Reddit Post with Image theme={"system"}
{
  "post": "Reddit post", // required, but not added to the post
  "platforms": ["reddit"], // required
  "mediaUrls": "https://my-media-url.com",
  "redditOptions": {
    "title": "Reddit Post Title", // required
    "subreddit": "test" // required (no "/r/" needed)
  }
}
```

## Reddit フレアの追加

一部のサブレディットではフレアが必要です。サブレディットのモデレーターがフレアを事前定義し、各フレアには一意の ID があります。Ayrshare への Reddit 投稿では、フレア ID と、テキストの上書きが可能な場合はオプションのフレアテキストを追加します。

```json Reddit Post with Flair theme={"system"}
{
  "redditOptions": {
    "flairId": "jM8nH92enjswas", // Id of the flair
    "flairText": "My New Flair text" // Override the flair text if allowed by flair
  }
}
```

[/post/redditFlair](/apis/utils/reddit-get-flair) エンドポイントを呼び出して、サブレディットのフレア ID を見つけることができます。

## サブレディットが存在するか確認する

[/validate エンドポイント](/apis/validate/check-subreddit) でサブレディットが存在するかを確認します。

## Reddit 投稿にリッチテキストフォーマットを追加する

Reddit 投稿に太字、斜体、上付き文字を追加したい場合は、[Reddit-flavored Markdown](https://www.reddit.com/wiki/markdown#wiki_new_reddit-flavored_markdown) を使用してください。

```json Reddit Post with Rich Text theme={"system"}
{
  "post": "For example, this can be *italic* or **bold** or ^super ",
  "platforms": ["reddit"],
  "redditOptions": {
    "title": "Rich Text Post",
    "subreddit": "test"
  }
}
```

## Reddit メンション

別の Reddit ユーザーやサブレディットをメンションします。

<ul class="custom-bullets">
  <li>投稿テキストに `@subreddit` または `u/username` を追加することで、Reddit ユーザーをメンションします。</li>
  <li>投稿テキストに `r/subreddit` を追加することで、サブレディットをメンションします。</li>
</ul>

たとえば:

```json Reddit Post with Mention theme={"system"}
{
  "post": "The best Reddit post ever for user @ayrshare and subreddit r/SiliconValleyHBO",
  "platforms": ["reddit"]
}
```

<Warning>
  メンションに関する [重要なルール](/testing/post-verification#mentions) をご確認ください。
</Warning>

## 文字数制限

詳細については [Reddit Character Limits](/help-center/technical-support/character_limits#reddit-character-limits) を参照してください。

## 追加のエンドポイント

<Card title="Get Reddit Flair" icon="code" href="/apis/utils/reddit-get-flair" horizontal />
