> Solana Developer Platform docs, served as Markdown. The [docs index](https://platform.solana.com/docs.md) lists every page and [llms.txt](https://platform.solana.com/docs/ai/llms.txt) the key ones; [SKILL.md](https://platform.solana.com/SKILL.md) has the rules for building on SDP.

# Update counterparty

Updates counterparty attributes.

`PATCH /v1/counterparties/{counterpartyId}`

At least one field must be provided. Use null on externalId to clear it.

Requires an [API key](/docs/developing-with-sdp/authentication) with the `counterparties.manage` action.

## Path parameters

- **`counterpartyId`** · `string` · required · min length 1 · example `cpty_example`

  Counterparty identifier.

## Headers

- **`x-project-id`** · `string` · min length 1 · example `prj_example`

  Required for dashboard sessions. API keys use their assigned project.

- **`Idempotency-Key`** · `string`

  Use a unique 1–255 printable ASCII key per operation. Reuse it with the same request on retries. An in-flight attempt returns `409`; a changed request returns `422`. [Retry and recovery rules](/docs/developing-with-sdp/idempotency).

## Request body

`application/json` · required

Update counterparty request body. At least one field must be provided.

- **`externalId`** · `string | null` · min length 1 · max length 256 · example `customer_42`

  Updated opaque external ID. Do not include personal data. Use null to clear.

- **`entityType`** · `string` · one of `individual`, `business` · example `business`

  Updated counterparty entity type.

- **`displayName`** · `string` · min length 1 · max length 512 · example `Jane Q. Doe`

  Updated searchable display name. Keep it minimal.

## Responses

- **`200`** Counterparty updated

  - **`data`** · `object` · required

    Counterparty response payload.

    - **`counterparty`** · `object` · required

      Counterparty record.

      - **`id`** · `string` · required · min length 1 · example `cpty_example`

        Counterparty identifier.

      - **`organizationId`** · `string` · required · min length 1 · example `org_example`

        Organization identifier.

      - **`projectId`** · `string | null` · required · min length 1 · example `prj_example`

        Project scope when the counterparty is project-scoped.

      - **`externalId`** · `string | null` · required · example `customer_42`

        Caller-supplied opaque identifier for cross-system reference. Do not place personal data in this indexed field.

      - **`entityType`** · `string` · required · one of `individual`, `business` · example `individual`

        Counterparty entity type.

      - **`displayName`** · `string` · required · example `Jane Doe`

        Human-readable, searchable display name. Keep it minimal because this indexed field is not application-encrypted.

      - **`status`** · `string` · required · one of `active`, `archived` · example `active`

        Counterparty status.

      - **`createdBy`** · `string | null` · required · min length 1 · example `usr_example`

        User who created the counterparty. Null when created via API key.

      - **`createdAt`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

        Creation timestamp.

      - **`updatedAt`** · `string` · required · format `date-time` · example `2025-01-02T00:00:00.000Z`

        Last update timestamp.

  - **`meta`** · `object` · required

    Response metadata.

    - **`requestId`** · `string` · required · min length 1 · example `req_example`

      Request identifier for tracing.

    - **`timestamp`** · `string` · required · format `date-time` · example `2025-01-01T00:00:00.000Z`

      ISO 8601 timestamp.

- **`400`** Bad Request

  - **`error`** · `object` · required

    Standard error payload.

    - **`code`** · `string` · required

      Machine-readable error code.

    - **`message`** · `string` · required

      Human-readable error message.

    - **`details`** · `object`

      Optional error details for debugging.

      - **`*`** · `any`

  - **`meta`** · `object`

    - **`requestId`** · `string` · min length 1 · example `req_example`

      Request identifier for tracing.

- **`401`** Unauthorized

  Same fields as `400`.

- **`403`** Forbidden. Requires the `counterparties.manage` action: an API key must hold it (a module's `manage` or `execute` also covers its `read`), and a signed-in member's organization role must include it. Without it the error is INSUFFICIENT_PERMISSIONS and `error.details.action` names the action. Any other 403 names its own reason.

  Same fields as `400`.

- **`404`** Not Found

  Same fields as `400`.

- **`409`** Conflict

  Same fields as `400`.

- **`422`** Unprocessable Entity

  Same fields as `400`.

- **`500`** Internal Server Error

  Same fields as `400`.

## Example request

```bash tab="cURL"
curl -X PATCH 'https://api.solana.com/v1/counterparties/cpty_example' \
  -H "Authorization: Bearer $SDP_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "externalId": "customer_42",
    "entityType": "business",
    "displayName": "Jane Q. Doe"
  }'
```

```ts tab="TypeScript"
const res = await fetch("https://api.solana.com/v1/counterparties/cpty_example", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.SDP_API_KEY}`,
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "externalId": "customer_42",
    "entityType": "business",
    "displayName": "Jane Q. Doe"
  })
});
```

```python tab="Python"
import os, requests, uuid

r = requests.patch("https://api.solana.com/v1/counterparties/cpty_example",
  headers={"Authorization": f"Bearer {os.environ['SDP_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
  json={
    "externalId": "customer_42",
    "entityType": "business",
    "displayName": "Jane Q. Doe"
  })
```

## Example responses

```json tab="200"
{
  "data": {
    "counterparty": {
      "id": "cpty_example",
      "organizationId": "org_example",
      "projectId": "prj_example",
      "externalId": "customer_42",
      "entityType": "individual",
      "displayName": "Jane Doe",
      "status": "active",
      "createdBy": "usr_example",
      "createdAt": "2025-01-01T00:00:00.000Z",
      "updatedAt": "2025-01-02T00:00:00.000Z"
    }
  },
  "meta": {
    "requestId": "req_example",
    "timestamp": "2025-01-01T00:00:00.000Z"
  }
}
```

```json tab="403"
{
  "error": {
    "code": "INSUFFICIENT_PERMISSIONS",
    "message": "Missing action: counterparties.manage",
    "details": {
      "action": "counterparties.manage"
    }
  },
  "meta": {
    "requestId": "req_example"
  }
}
```

Error responses use the [standard error shape](/docs/reference/conventions/errors).
