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

# Verify a sign-up code

> Check the code the person read back and get an API key with every permission.

> [!NOTE]
>
> No key needed. See [Sign up from an AI agent](https://docs.postsyncer.com/guides/agent-signup.md) for the whole flow.

Checks the code from [Send a sign-up code](https://docs.postsyncer.com/api-reference/agent-signup/code.md) and answers with an API key.

* **A new address** gets a new account, made now: its own workspace (with the `timezone` sent for the code), and the email marked verified. `new_account` is `true`. While the account is in its first week, `first_week_ends_at` says when the week ends: say to the person, "For your first 7 days you get 10 accounts, unlimited posts and Analytics. After that you keep Free: 2 accounts and 20 posts a month."
* **An address with an account** gets a new key on that account. Its name, plan and settings don't change. `new_account` is `false`.
* **A teammate** in someone else's workspace who owns none gets no key (`teammate_only`): only owners make keys. **An inactive account** gets none either (`account_inactive`).

The key has every permission and no end date, the same as **Everything** in Settings → API. It's named after the agent (`key_name`), or "AI agent" for a name PostSyncer doesn't know, and shows in Settings → API like any other key. Each verify makes a new key.

## Save the key

* Save `api_key` in the agent's user-level MCP settings, never in a project file or anything that could be committed. [Sign up from an AI agent](https://docs.postsyncer.com/guides/agent-signup.md#save-the-key) says where, agent by agent.
* Don't show the full key to the person.
* For the rest of the chat, call the REST API with it: most agents load a new MCP server only after a restart.

## Limits

| Limit | Count |
| - | - |
| Wrong tries for one code | 5, then the code stops working |
| Checks from one IP address | 30 an hour |
| New accounts from one IP address | 20 a day |

## Errors

| Status | `error` | When | Retry? |
| - | - | - | - |
| 403 | `teammate_only` | The address is only a teammate in someone else's workspace. | No: ask the workspace owner for access. |
| 403 | `account_inactive` | The account is inactive. | No: write to [support@postsyncer.com](mailto:support@postsyncer.com). |
| 404 | | Agent sign-up isn't switched on. | No. |
| 422 | `code_wrong` | The code isn't right. `tries_left` says how many more tries it takes. | Yes, with the right code, while `tries_left` is above 0. |
| 422 | `code_expired` | The code is over 10 minutes old, was used, or was replaced by a newer one. | Ask for a new code. |
| 422 | `too_many_tries` | The code was entered wrong 5 times. | Ask for a new code. |
| 422 | | A field is missing or wrong. | No: fix the request. |
| 429 | `rate_limited` | A limit above is reached. | Yes, after `Retry-After` seconds when it's given. |

Every error has a plain `message`: pass it on to the person.

## Related

* [Send a sign-up code](https://docs.postsyncer.com/api-reference/agent-signup/code.md): the step before.
* [Create a connect link](https://docs.postsyncer.com/api-reference/accounts/connect-link.md): connect the person's social accounts next.


## OpenAPI

````yaml POST /agent-signup/verify
openapi: 3.0.3
info:
  title: PostSyncer API
  description: >-
    Post to 12 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:
  /agent-signup/verify:
    post:
      tags:
        - Agent sign-up
      summary: Verify a sign-up code
      description: >-
        No key needed. Checks the code from [Send a sign-up
        code](/api-reference/agent-signup/code) and answers with an API key that
        has every permission, named after the agent. A new address gets a new
        account, with its own workspace and the email marked verified. An
        address that has an account gets a new key on it, and nothing else on
        the account changes; its owner is emailed that a key was added. A
        teammate in someone else's workspace, or an inactive account, gets no
        key. Save the key in the agent's user-level MCP settings, never in a
        project file, and don't show it to the person. Limits: 5 wrong tries end
        a code, 30 checks an hour and 20 new accounts a day per IP address.
      operationId: verifyAgentSignupCode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - email
                - code
                - agent
              properties:
                email:
                  type: string
                  format: email
                  maxLength: 254
                  description: The address the code was sent to.
                code:
                  type: string
                  pattern: ^\d{6}$
                  description: The 6 digits from the email, as the person read them.
                agent:
                  type: string
                  maxLength: 60
                  description: >-
                    Your own name, as you sent it for the code. The key is named
                    after it when PostSyncer knows the name, else "AI agent".
            examples:
              default:
                summary: The code the person read back
                value:
                  email: sam@haldencoffee.com
                  code: '482913'
                  agent: Claude Code
      responses:
        '200':
          description: The key, and who it acts as. `api_key` is shown here only.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentSignupKey'
              examples:
                default:
                  summary: A new account, in its first week
                  value:
                    api_key: 418|kP3vX9qL2mN8rT5wY7zA1bC4dE6fG0hJ2kL4mN6p
                    key_name: Claude Code
                    new_account: true
                    user:
                      id: 9312
                      email: sam@haldencoffee.com
                      name: sam
                    workspace:
                      id: 4815
                      name: sam
                    first_week_ends_at: '2030-03-20T09:00:00+00:00'
                    mcp_url: https://postsyncer.com/mcp
                    setup_url: https://postsyncer.com/agents/setup.md
                existing:
                  summary: An account the address already had
                  value:
                    api_key: 419|Qw8eR2tY6uI0oP4aS8dF2gH6jK0lZ4xC8vB2nM6q
                    key_name: Cursor
                    new_account: false
                    user:
                      id: 2207
                      email: sam@haldencoffee.com
                      name: Sam Haile
                    workspace:
                      id: 12
                      name: Halden Coffee
                    first_week_ends_at: null
                    mcp_url: https://postsyncer.com/mcp
                    setup_url: https://postsyncer.com/agents/setup.md
        '403':
          description: >-
            The address has an account that can't get a key: it's only a
            teammate in someone else's workspace (`teammate_only`), or it's
            inactive (`account_inactive`). The code is used up.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentSignupError'
              examples:
                teammate_only:
                  summary: Only a teammate in someone else's workspace
                  value:
                    error: teammate_only
                    message: >-
                      This email is a teammate in someone else's workspace. Ask
                      the workspace owner for access.
                account_inactive:
                  summary: The account is inactive
                  value:
                    error: account_inactive
                    message: >-
                      This account is inactive. Write to support@postsyncer.com
                      for help.
        '404':
          $ref: '#/components/responses/AgentSignupOff404'
        '422':
          description: >-
            The code is wrong (`code_wrong`, with `tries_left`), no longer works
            (`code_expired`: over 10 minutes old, used, replaced by a newer one,
            or never sent), or was entered wrong 5 times (`too_many_tries`). Or
            a field is missing or wrong (`errors`).
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/AgentSignupError'
                  - $ref: '#/components/schemas/ValidationError'
              examples:
                code_wrong:
                  summary: A wrong code, 4 tries left
                  value:
                    error: code_wrong
                    message: That code isn't right. You can try 4 more times.
                    tries_left: 4
                code_wrong_last:
                  summary: A wrong code, no tries left
                  value:
                    error: code_wrong
                    message: >-
                      That code isn't right, and it can't be tried again. Ask
                      for a new code.
                    tries_left: 0
                code_expired:
                  summary: The code no longer works
                  value:
                    error: code_expired
                    message: This code no longer works. Ask for a new code.
                too_many_tries:
                  summary: Entered wrong 5 times
                  value:
                    error: too_many_tries
                    message: >-
                      This code was entered wrong too many times. Ask for a new
                      code.
                validation:
                  summary: A required field is missing
                  value:
                    message: The code field is required.
                    errors:
                      code:
                        - The code field is required.
        '429':
          description: >-
            A limit is reached: 30 checks an hour from this IP address, or 20
            new accounts today from it. Nothing was made. Wait `Retry-After`
            seconds when it's given.
          headers:
            Retry-After:
              description: Seconds until requests are allowed again.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentSignupError'
              examples:
                checks:
                  summary: 30 checks this hour
                  value:
                    error: rate_limited
                    message: Too many tries. Try again in 60 minutes.
                new_accounts:
                  summary: 20 new accounts today from this network
                  value:
                    error: rate_limited
                    message: >-
                      Too many new accounts from this network today. Try again
                      tomorrow.
      security: []
components:
  schemas:
    AgentSignupKey:
      type: object
      description: 'A verified agent sign-up: the new key and who it acts as.'
      required:
        - api_key
        - key_name
        - new_account
        - user
        - workspace
        - first_week_ends_at
        - mcp_url
        - setup_url
      properties:
        api_key:
          type: string
          description: >-
            The API key, with every permission and no end date. Shown only here:
            save it in the agent's user-level MCP settings, never in a project
            file, and use it as `Authorization: Bearer …`.
        key_name:
          type: string
          description: >-
            The key's name in Settings → API: the agent's name when PostSyncer
            knows it, else "AI agent".
        new_account:
          type: boolean
          description: >-
            True when the account was made now; false when the address already
            had one.
        user:
          type: object
          description: The person the key acts as.
          required:
            - id
            - email
            - name
          properties:
            id:
              type: integer
            email:
              type: string
            name:
              type: string
              description: A new account's name is the part of the address before the @.
        workspace:
          type: object
          description: >-
            The person's first own workspace: where the agent connects accounts
            and saves posts.
          required:
            - id
            - name
          properties:
            id:
              type: integer
            name:
              type: string
        first_week_ends_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            While the account is in its first week on Free (10 accounts,
            unlimited posts and Analytics), when the week ends. Null otherwise.
        mcp_url:
          type: string
          description: >-
            The MCP server, for later chats: add it with the key as a Bearer
            header.
        setup_url:
          type: string
          description: The steps for agents, in markdown.
    AgentSignupError:
      type: object
      description: >-
        Agent sign-up said no. Branch on `error`; pass `message` on to the
        person.
      required:
        - error
        - message
      properties:
        error:
          type: string
          enum:
            - code_wrong
            - code_expired
            - too_many_tries
            - teammate_only
            - account_inactive
            - rate_limited
          description: What happened.
        message:
          type: string
          description: Plain words to pass on to the person.
        tries_left:
          type: integer
          minimum: 0
          description: '`code_wrong` only: how many more tries the code takes.'
    ValidationError:
      type: object
      description: '422: the request didn''t pass validation, and nothing changed.'
      required:
        - message
        - errors
      properties:
        message:
          type: string
          description: >-
            The first error and, when there are more, how many: `(and 1 more
            error)`, `(and 2 more errors)`.
        errors:
          type: object
          description: >-
            The messages, by field. A field inside a list is named with dots:
            `accounts.0.id`.
          additionalProperties:
            type: array
            items:
              type: string
    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:
    AgentSignupOff404:
      description: Agent sign-up isn't switched on.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            not_found:
              summary: Not switched on
              value:
                message: Not found.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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