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

# List Discord channels

> List the channels and forum tags of a connected Discord server, to post into one.

> [!NOTE]
>
> Needs `accounts:read`. See [Permissions](/docs/essentials/authentication.md#permissions).

A Discord account is a whole server, so each post picks a channel. Send a channel's `id` as `accounts[].settings.channel_id` on [Create a post](/docs/api-reference/posts/create.md), or save it in the account's [Post defaults](/docs/api-reference/accounts/update-account-defaults.md) so posts without one go there. In a forum or media channel, send `thread_name` (needed to schedule or publish there) and up to 5 of its tag ids as `applied_tags`. A poll goes only in a `text` or `announcement` channel.

```json theme={null}
{
  "accounts": [
    {
      "id": 16412,
      "settings": {
        "channel_id": "222333444555666777",
        "thread_name": "Next month's roast",
        "applied_tags": ["1111222233334444555"]
      }
    }
  ]
}
```

* The list holds the `text`, `announcement`, `forum` and `media` channels, in Discord's own order: those outside a category first, then each category's, with `parent_name`.
* A forum or media channel lists its `available_tags`, and `requires_tag` is `true` when every post there needs a tag. A tag with `moderated: true` is one only moderators can add on Discord: PostSyncer's bot asks for that right, so it can be used too.
* The list is the one PostSyncer keeps for the account. When it's more than 5 minutes old, it's read again in the background; only a server never read yet is read from Discord right away. Channel and tag ids are long numbers: keep them as strings.

## Errors

| Status | `code` | When | Retry? |
| - | - | - | - |
| 400 | `INVALID_PROVIDER` | The account isn't a Discord account. | No: use a Discord account. |
| 401 | | No API key, or not a valid one. | No: fix the key. |
| 403 | | The key lacks `accounts:read`, or its user is inactive. | No: grant it in Settings → API. |
| 404 | | No account with that id in the workspaces the key can reach. | No. |
| 409 | `NEEDS_RECONNECT` | The Discord server needs to be reconnected in PostSyncer, or the bot is no longer in it. | After the server is reconnected. |
| 429 | | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |
| 502 | `PLATFORM_ERROR` | A server never read yet, and Discord did not answer with its channels. `message` gives its reason. | Yes, in a moment. |

## Related

* [Post to Discord](/docs/platforms/discord.md): what a Discord post takes.
* [Create a post](/docs/api-reference/posts/create.md): `channel_id`, `thread_name` and `applied_tags` in `settings`.


## OpenAPI

````yaml GET /accounts/{account}/discord/channels
openapi: 3.0.3
info:
  title: PostSyncer API
  description: >-
    Post to 14 social networks from your code: posts, media, comments,
    analytics, webhooks and more.
  version: 1.0.0
servers:
  - url: https://postsyncer.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: The workspaces the key can reach.
  - name: Accounts
    description: Connected social accounts, links to connect more, and disconnecting them.
  - name: Posts
    description: Drafts, scheduled and published posts, approvals and a post's history.
  - name: Post settings
    description: A post's auto-plug, comment moderation and contact collection.
  - name: Media
    description: >-
      The media library: file uploads, URL imports, and reading videos and
      social posts' files.
  - name: Folders
    description: Folders that organise the media library.
  - name: Comments
    description: >-
      Comments on your posts: reading, replying, editing, hiding, deleting and
      syncing them.
  - name: Reviews
    description: Google Business Profile reviews and your replies to them.
  - name: Analytics
    description: Workspace, account and post performance.
  - name: Brand
    description: >-
      A workspace's brand: identity, voice, look, accounts, competitors,
      learnings and rules.
  - name: Labels
    description: Labels used to tag posts.
  - name: Campaigns
    description: Campaigns used to group posts.
  - name: Snippets
    description: Saved snippets and hashtag groups to drop into posts.
  - name: Webhooks
    description: Signed webhook endpoints that get your notification events.
  - name: Billing
    description: >-
      The owner's plan, invoices and the links that pay for, change or cancel
      it.
  - name: Team
    description: A workspace's teammates and invitations, and their roles.
  - name: Notifications
    description: >-
      Your bell and notification settings, and the workspace's Slack, Discord
      and Telegram channels.
  - name: Blog-to-social
    description: Blog feeds that turn a workspace's new articles into posts.
  - name: Products
    description: Products the workspace's posts can promote.
  - name: Contacts
    description: People who commented on the workspace's posts, and the lists they are on.
  - name: Profile
    description: 'The key''s user: their name and sign-in email.'
  - name: API keys
    description: 'Your API keys: listing and deleting them.'
  - name: Agent sign-up
    description: >-
      An AI agent signs a person up with a code emailed to them, and gets their
      first key. No key needed.
paths:
  /accounts/{account}/discord/channels:
    get:
      tags:
        - Accounts
      summary: List Discord channels
      description: >-
        Needs `accounts:read`. Postable channels (`text`, `announcement`,
        `forum`, `media`) and forum `available_tags` of a connected Discord
        server, as PostSyncer last read them (read again in the background every
        few minutes). Send a channel `id` as `accounts[].settings.channel_id` on
        Create a post.
      operationId: listDiscordChannels
      parameters:
        - name: account
          in: path
          required: true
          description: The Discord server account.
          schema:
            type: integer
      responses:
        '200':
          description: Postable channels in the connected Discord server.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/DiscordChannel'
              examples:
                default:
                  summary: Postable channels in a connected Discord server
                  value:
                    data:
                      - id: '111222333444555666'
                        name: announcements
                        type: announcement
                        type_code: 5
                        parent_name: Community
                        available_tags: []
                        requires_tag: false
                      - id: '222333444555666777'
                        name: roast-polls
                        type: forum
                        type_code: 15
                        parent_name: Community
                        available_tags:
                          - id: '333000000000000001'
                            name: Launch
                            moderated: false
                        requires_tag: true
        '400':
          description: The account is not a Discord account.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
                  - type: object
                    required:
                      - code
                    properties:
                      code:
                        type: string
                        enum:
                          - INVALID_PROVIDER
              examples:
                invalid_provider:
                  summary: Wrong platform
                  value:
                    message: Account is not a Discord account
                    code: INVALID_PROVIDER
        '401':
          $ref: '#/components/responses/Unauthorized401'
        '403':
          description: The key lacks `accounts:read`, or its user is inactive.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                missing_permission:
                  summary: The key lacks accounts:read
                  value:
                    message: >-
                      This API key does not have the "accounts:read" permission.
                      Edit the key in PostSyncer under Settings → API to grant
                      it.
                inactive_account:
                  summary: The key's user is inactive
                  value:
                    message: Your account is inactive.
        '404':
          description: Account not found in your accessible workspaces.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_found:
                  summary: No such account
                  value:
                    message: Not found.
        '409':
          description: The Discord account needs to be reconnected.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
                  - type: object
                    required:
                      - code
                    properties:
                      code:
                        type: string
                        enum:
                          - NEEDS_RECONNECT
              examples:
                needs_reconnect:
                  summary: Reconnect required
                  value:
                    message: >-
                      This Discord server needs to be reconnected in PostSyncer
                      before its channels can be listed.
                    code: NEEDS_RECONNECT
        '429':
          $ref: '#/components/responses/RateLimited429'
        '502':
          description: Discord did not return the channel list.
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Error'
                  - type: object
                    required:
                      - code
                    properties:
                      code:
                        type: string
                        enum:
                          - PLATFORM_ERROR
              examples:
                platform_error:
                  summary: Upstream error
                  value:
                    message: >-
                      Discord did not list this server's channels: Discord could
                      not be reached. Try again in a moment.
                    code: PLATFORM_ERROR
components:
  schemas:
    DiscordChannel:
      type: object
      description: >-
        A postable channel in a connected Discord server (GET
        /accounts/{account}/discord/channels).
      required:
        - id
        - name
        - type
        - type_code
        - parent_name
        - available_tags
        - requires_tag
      properties:
        id:
          type: string
          description: Channel snowflake ID to pass as accounts[].settings.channel_id.
        name:
          type: string
        type:
          type: string
          enum:
            - text
            - announcement
            - forum
            - media
        type_code:
          type: integer
        parent_name:
          type: string
          nullable: true
          description: The channel's category, or null when it's in none.
        available_tags:
          type: array
          items:
            type: object
            required:
              - id
              - name
              - moderated
            properties:
              id:
                type: string
              name:
                type: string
              moderated:
                type: boolean
                description: >-
                  Only members with Manage Threads may apply it on Discord.
                  PostSyncer's bot asks for Manage Threads; on a server whose
                  bot role lacks it, a post with this tag is refused.
        requires_tag:
          type: boolean
          description: >-
            A forum or media channel whose every post needs one of its
            `available_tags`.
    Error:
      type: object
      description: >-
        An error answer. Every one has `message`, in plain words; some add an
        `error` code and fields of their own.
      required:
        - message
      properties:
        message:
          type: string
          description: What went wrong and what to do about it.
        error:
          type: string
          description: >-
            A code a few errors add, such as `rate_limited`. See [Handle
            errors](/essentials/error-handling#answers-with-an-error-code).
  responses:
    Unauthorized401:
      description: No API key, or not a valid one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthenticated:
              summary: No valid API key
              value:
                message: Unauthenticated.
    RateLimited429:
      description: >-
        More than 60 requests in a minute from this key's user (the API and the
        MCP server share the count). Wait `Retry-After` seconds.
      headers:
        Retry-After:
          description: Seconds until requests are allowed again.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Requests allowed a minute.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Requests left this minute.
          schema:
            type: integer
        X-RateLimit-Reset:
          description: When requests are allowed again, as a Unix timestamp.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            too_many_attempts:
              summary: Too many requests
              value:
                message: Too Many Attempts.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.