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

# Create Target Account

> Add target accounts for opportunity prioritization

Two formats supported, and **both are additive**:

| Format | Behavior |
| - | - |
| Single object | Adds one account, keeps existing |
| Batch array | Adds all of them, keeps existing |

## LinkedIn URL

Every new account needs its **LinkedIn company page URL**: `linkedin.com/company/acme`,
or the company's numeric id, `linkedin.com/company/1035`. With or without
`https://www.`, a trailing slash or a query string. A person's profile, a school
page or a showcase page is refused. Clustr checks the URL's shape only. To find it, search the company on LinkedIn and copy the address of its
page.

* **Single object:** a missing or invalid URL answers `422` with code
  `invalid_linkedin_url` and the reason, and nothing is added.
* **Batch:** an entry without a valid URL is not added and is listed in
  `rejected` with its position in the request and the reason. The other entries
  are added. When no entry is left to add, the call answers `422`.

Accounts already on your list are unchanged, with or without a URL.

## Tier

Either format accepts a `tier` per account: the name your workspace uses for it,
from [List Account Tiers](https://docs.clustr-ai.com/api-reference/list-tiers.md).

An unknown tier name **rejects the whole request** rather than creating the tier
or quietly dropping it. A typo in a 500-row import would otherwise become a
permanent tier nobody chose, and a dropped one loses data you believed you sent.
The error names both the tier you sent and the row it was on.

A tier belongs to the company behind an account, and a brand-new account has
usually not been matched to one yet. When that happens the tier is **queued on
the account and applied automatically** as soon as the match happens, so nothing
is lost in the gap. You do not have to poll or re-send it.

## Tag

Either format accepts a `tag` per account: one of your account tags, as your
workspace spells it, from [List Tags](https://docs.clustr-ai.com/api-reference/list-tags.md). The tag is added
to the account, also when the company is already on your list.

An unknown tag name **rejects the whole request**. Tags are never created this way.

```bash cURL (single) theme={null}
curl -X POST https://api.clustr-ai.com/api/public/target-accounts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"company_name": "Acme Corp", "linkedin_url": "https://www.linkedin.com/company/acme-corp", "tier": "Tier 1"}'
```

```bash cURL (batch) theme={null}
curl -X POST https://api.clustr-ai.com/api/public/target-accounts \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target_companies": [{"name": "Acme Corp", "linkedin_url": "linkedin.com/company/acme-corp"}, {"name": "Globex Inc", "linkedin_url": "linkedin.com/company/globex"}]}'
```

```python Python theme={null}
import requests

requests.post(
    "https://api.clustr-ai.com/api/public/target-accounts",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"company_name": "Acme Corp", "linkedin_url": "https://www.linkedin.com/company/acme-corp"},
)
```

```json Single Account theme={null}
{
  "company_name": "Acme Corp",
  "linkedin_url": "https://www.linkedin.com/company/acme-corp",
  "tier": "Tier 1"
}
```

```json Batch theme={null}
{
  "target_companies": [
    {
      "name": "Acme Corp",
      "linkedin_url": "https://www.linkedin.com/company/acme-corp",
      "tier": "Tier 1",
      "tag": "Strategic"
    },
    {
      "name": "Globex Inc",
      "linkedin_url": "https://www.linkedin.com/company/globex",
      "tier": "Tier 2"
    }
  ]
}
```

```json 201 theme={null}
{
  "success": true,
  "data": {
    "message": "Target companies created successfully",
    "count": 1
  }
}
```

```json 201 (one entry rejected) theme={null}
{
  "success": true,
  "data": {
    "message": "Target companies created successfully",
    "count": 1,
    "rejected": [
      {
        "index": 1,
        "name": "Globex Inc",
        "reason": "A LinkedIn company URL is required, like linkedin.com/company/acme."
      }
    ]
  }
}
```

```json 422 (no LinkedIn URL) theme={null}
{
  "success": false,
  "error": {
    "message": "A LinkedIn company URL is required, like linkedin.com/company/acme.",
    "code": "invalid_linkedin_url"
  }
}
```

```json 400 (no accounts) theme={null}
{
  "success": false,
  "error": {
    "message": "No target companies provided",
    "code": "BAD_REQUEST"
  }
}
```

```json 400 (unknown tier) theme={null}
{
  "success": false,
  "error": {
    "message": "No tier named \"Platinum\" in this workspace (entry at index 3). Tiers are named per workspace; list them at GET /public/tenant-tiers",
    "code": "BAD_REQUEST"
  }
}
```

```json 400 (unknown tag) theme={null}
{
  "success": false,
  "error": {
    "message": "No account tag named \"Strategc\" in this workspace (entry at index 0). Tags are never created by an import",
    "code": "BAD_REQUEST"
  }
}
```

```json 401 theme={null}
{
  "success": false,
  "error": {
    "message": "Invalid or missing API key",
    "code": "UNAUTHORIZED"
  }
}
```


## OpenAPI

````yaml POST /target-accounts
openapi: 3.1.0
info:
  title: Clustr Public API
  description: >
    Programmatic access to your Clustr network: import connectors, search warm
    intros (opportunities), and manage target accounts.


    ## Authentication

    All endpoints require a Bearer token (API key) in the `Authorization`
    header.


    ```

    Authorization: Bearer <your_api_key>

    ```


    API keys can be created and managed from the [API settings
    page](https://app.clustr-ai.com/api).
  version: '1.0'
  contact:
    name: Clustr Support
    url: https://clustr-ai.com
servers:
  - url: https://api.clustr-ai.com/api/public
    description: Production
security:
  - BearerAuth: []
paths:
  /target-accounts:
    post:
      tags:
        - Target Accounts
      summary: Create Target Account
      description: >
        Add target accounts for opportunity prioritization.


        **Single object format** adds one account and leaves your other accounts
        as they are:

        ```json

        { "company_name": "Acme Corp", "linkedin_url": "...", "tier": "Tier 1" }

        ```


        **Batch array format** adds every account in the list and skips the ones
        already present:

        ```json

        { "target_companies": [{ "name": "Acme Corp", "linkedin_url": "...",
        "tier": "Tier 1" }] }

        ```

        Inside the batch, `linkedinUrl` is accepted as well; it wins if both are
        sent.


        **LinkedIn URL required.** Every new account needs its LinkedIn company

        page URL, like `linkedin.com/company/acme` or
        `linkedin.com/company/1035`

        (with or without `https://www.`, a trailing slash or a query string). A

        person's profile, a school page or a showcase page is refused. In a

        batch, an entry without a valid one is skipped and listed in

        `rejected` with its reason; the other entries are added. The single

        object form, or a batch with no valid entry, answers `422` with code

        `invalid_linkedin_url`. Accounts already on your list are unchanged.


        **Tier.** Each entry may carry a `tier`, the name as your workspace

        spells it (see [List Account Tiers](/api-reference/list-tiers)). An

        unknown name rejects the whole request, so every tier on your accounts

        is one your team created, even after a large import with a typo in it.


        An account takes its tier once it has matched a company, which a

        brand-new account usually has yet to do. Clustr keeps the tier with the

        account and applies it as soon as the match happens.


        **Tag.** Each entry may carry a `tag`, one of your account tags as your

        workspace spells it (see [List Tags](/api-reference/list-tags)). The tag

        is added to the account, also when it is already on your list. An

        unknown name rejects the whole request: tags are never created this way.
      operationId: createTargetAccount
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTargetAccountRequest'
            examples:
              single:
                summary: Add one account
                value:
                  company_name: Acme Corp
                  linkedin_url: https://www.linkedin.com/company/acme-corp
                  tier: Tier 1
                  tag: Strategic
              batch:
                summary: Add several accounts
                value:
                  target_companies:
                    - name: Acme Corp
                      linkedin_url: https://www.linkedin.com/company/acme-corp
                      tier: Tier 1
                    - name: Globex Inc
                      linkedin_url: https://www.linkedin.com/company/globex
      responses:
        '201':
          description: Target accounts created
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - data
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      message:
                        type: string
                        example: Target companies created successfully
                      count:
                        type: integer
                        example: 2
                      rejected:
                        type: array
                        description: >-
                          Entries not added because they have no valid LinkedIn
                          company URL. Omitted when every entry had one.
                        items:
                          type: object
                          properties:
                            index:
                              type: integer
                              description: The entry's 0-based position in the request.
                              example: 1
                            name:
                              type: string
                              example: Globex Inc
                            reason:
                              type: string
                              example: >-
                                A LinkedIn company URL is required, like
                                linkedin.com/company/acme.
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
        '422':
          description: >-
            No account was added because none has a valid LinkedIn company URL
            (code `invalid_linkedin_url`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CreateTargetAccountRequest:
      type: object
      description: >-
        Accepts two formats:

        - **Single object**: `{"company_name": "...", "linkedin_url": "...",
        "tier": "..."}`
          adds one account.
        - **Batch array**: `{"target_companies": [...]}` adds every account in
        the list and
          skips the ones already present.

        Every new account needs its LinkedIn company page URL, such as

        `linkedin.com/company/acme` or `linkedin.com/company/1035`. An entry
        without a valid one

        is listed in `rejected` instead of being added.
      properties:
        targetCompanies:
          type: array
          deprecated: true
          description: >-
            The same as `target_companies`. `target_companies` is the name to
            use.
          items:
            type: object
            properties:
              name:
                type: string
                description: Company name.
              linkedinUrl:
                type: string
                description: The company's LinkedIn page URL.
              linkedin_url:
                type: string
                description: The same as `linkedinUrl`.
              tier:
                type: string
                description: The tier name.
              tag:
                type: string
                description: An account tag name.
        company_name:
          type: string
          description: The company name, in the single object format.
          example: Acme Corp
        linkedin_url:
          type: string
          description: >-
            The company's LinkedIn page URL, in the single object format.
            Required for a new account.
          example: https://www.linkedin.com/company/acme-corp
        tier:
          type: string
          description: >-
            The tier name, spelled the way your workspace spells it, in the
            single object format. An unknown tier name is rejected.
          example: Tier 1
        tag:
          type: string
          description: >-
            An account tag name, spelled the way your workspace spells it, in
            the single object format. The tag is added to the account. An
            unknown tag name is rejected.
          example: Strategic
        target_companies:
          type: array
          description: >-
            The batch format: a list of accounts to add to your existing ones.
            Accounts already present are skipped.
          items:
            type: object
            required:
              - name
            properties:
              name:
                type: string
                description: Company name
                example: Acme Corp
              linkedin_url:
                type: string
                description: >-
                  The company's LinkedIn company page URL. `linkedinUrl` is
                  accepted too; if

                  both are sent, `linkedinUrl` wins. An entry without a valid
                  one is listed in

                  `rejected` instead of being added.
                example: https://www.linkedin.com/company/acme-corp
              linkedinUrl:
                type: string
                description: >-
                  Another spelling of `linkedin_url`. When both are sent, this
                  one wins.
                example: https://www.linkedin.com/company/acme-corp
              tier:
                type: string
                description: >-
                  The tier name, spelled the way your workspace spells it. An
                  unknown tier name is rejected.
                example: Tier 1
              tag:
                type: string
                description: >-
                  An account tag name, spelled the way your workspace spells it.
                  The tag is added to the account. An unknown tag name is
                  rejected.
                example: Strategic
    ErrorResponse:
      type: object
      required:
        - success
        - error
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            message:
              type: string
              example: Invalid request body
            code:
              type: string
              example: BAD_REQUEST
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: The API key you created on the API settings page of the Clustr app.

````

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