# Move listings into a project

Adresse: https://docs.athaus.ai/api/v1/referenz/assign-project-listings

> Aufruf, Parameter, Antwort und Fehler von POST /v1/projects/{externalProjectId}/assign.

Typ: Referenz
Zuletzt aktualisiert: 2026-11-14

Makes existing listings units of the project, up to 500 in one call, all or nothing. Each keeps its own data; its `data.location.unit` is the unit number and must be set and unique in the project (409 `unit_already_exists`, each item named by `externalListingIds[n]`). A listing that is a unit of another project is refused (400): release it there first. A listing whose unit status does not fit the project (a released `sold` unit into a rental project) is 409 `unit_status_invalid`. A listing that is a unit of this project already stays as it is, so a repeat changes nothing. A project holds at most 1000 units: a call that would pass that is 409 `project_unit_limit_exceeded` and changes nothing. Needs write access to `projects`.

Braucht den Scope [`propose`](/api/v1/anmeldung#scopes) und mindestens die Stufe `write` auf `projects`.

## Aufruf [#aufruf]

```http
POST https://api.athaus.ai/v1/projects/{externalProjectId}/assign
```

### Parameter [#parameter]

**Pfad**

| Name                | Typ      | Pflicht | Beschreibung                                                                                                                                                                                                                                                              |
| ------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `externalProjectId` | `string` | ja      | Your reference of the project: the value of metadata.source.offererMarketingKey. A project without one has its own projectId here, and the projectId always works in the path. 1 to 128 letters, digits, dots, underscores or hyphens, not starting or ending with a dot. |

**Kopf**

| Name              | Typ      | Pflicht | Beschreibung                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ----------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Athaus-Version`  | `string` | nein    | Optional and carries nothing a client needs: the version is the path. Accepted when it says `v1` or `1`. Any other value is a 400 `api_version_unsupported`.                                                                                                                                                                                                                                                                         |
| `Idempotency-Key` | `string` | nein    | Makes a retry safe: the same key with the same body returns the first answer and writes nothing twice. A random value of at least 128 bits, for example a UUID, 1 to 255 characters. The key is kept for 24 hours and scoped to the API key and this operation. The same key with a different body is a 422; while the first request still runs it is a 409. Only successful answers are kept: after an error the key is free again. |

### Rumpf [#rumpf]

JSON mit `Content-Type: application/json`. Ein Feld, das die API nicht kennt, ist ein `400`, und `errors[].name` nennt das Feld. Der Rumpf ist Pflicht.

| Feld                 | Typ        | Beschreibung                                                                                                                                                |
| -------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `externalListingIds` | `string[]` | The listings to move into the project or out of it. Each keeps its own data when it is assigned; a listing without `data.location.unit` cannot be assigned. |

### Beispiel [#beispiel]

```bash
curl -X POST "https://api.athaus.ai/v1/projects/PRJ-1-ext/assign" \
  -H "Authorization: Bearer ath_live_..." \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"externalListingIds":["PRJ-7-WE-1","PRJ-7-WE-2"]}'
```

## Antwort [#antwort]

Bei Erfolg kommt `202` mit `ProjectUnitsReceipt`.

### ProjectUnitsReceipt [#projectunitsreceipt]

| Feld                           | Typ        | Beschreibung                                                         |
| ------------------------------ | ---------- | -------------------------------------------------------------------- |
| `requestId`                    | `string`   |                                                                      |
| `projectId`                    | `string`   |                                                                      |
| `externalProjectId`            | `string`   |                                                                      |
| `listings`                     | `object[]` | The listings the call created or moved, in the order of the request. |
| `listings[].listingId`         | `string`   |                                                                      |
| `listings[].externalListingId` | `string`   |                                                                      |
| `listings[].unit`              | `string`   |                                                                      |
| `warnings`                     | `object[]` |                                                                      |
| `warnings[].type`              | `string`   |                                                                      |
| `warnings[].message`           | `string`   |                                                                      |

### Köpfe der Antwort [#köpfe-der-antwort]

| Kopf                  | Beschreibung                                                                                                    |
| --------------------- | --------------------------------------------------------------------------------------------------------------- |
| `Request-Id`          | Identifies this request. Quote it in a support request.                                                         |
| `Athaus-Version`      | The API version of this response: v1.                                                                           |
| `Athaus-Release`      | The release of v1 that answered, for example 1.0. A label for support and changelogs; no request can select it. |
| `RateLimit-Policy`    | The quota policy of the bucket that applies.                                                                    |
| `RateLimit`           | Remaining quota and seconds until the bucket is full again.                                                     |
| `Idempotent-Replayed` | `true` when this is the stored answer to an earlier request with the same Idempotency-Key.                      |

## Fehler [#fehler]

Jeder Fehler kommt als [Problem Details](/api/v1/fehler). Verzweige auf `code`, nicht auf `title` oder `detail`.

| Status | Codes                                                                                                                              | Bedeutung                                                                                                   |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| `400`  | [`api_version_unsupported`](/api/errors#api_version_unsupported), [`invalid_body`](/api/errors#invalid_body)                       | Invalid request.                                                                                            |
| `401`  | [`unauthorized`](/api/errors#unauthorized)                                                                                         | Missing or invalid API key.                                                                                 |
| `403`  | [`insufficient_permissions`](/api/errors#insufficient_permissions), [`plan_required`](/api/errors#plan_required)                   | The key lacks a right, or the plan does not include API access.                                             |
| `404`  | [`not_found`](/api/errors#not_found)                                                                                               | Nothing under this ID.                                                                                      |
| `409`  | [`unit_already_exists`](/api/errors#unit_already_exists), [`project_unit_limit_exceeded`](/api/errors#project_unit_limit_exceeded) | The request conflicts with the state of the resource (for example a duplicate), or with an idempotency key. |
| `413`  | [`payload_too_large`](/api/errors#payload_too_large)                                                                               | The request body is larger than 512 KB.                                                                     |
| `415`  | [`invalid_input`](/api/errors#invalid_input)                                                                                       | The request body is not JSON. Send `Content-Type: application/json`.                                        |
| `422`  | [`idempotency_key_reused`](/api/errors#idempotency_key_reused)                                                                     | The idempotency key was already used with a different request body.                                         |
| `429`  | [`rate_limited`](/api/errors#rate_limited)                                                                                         | Rate limit exceeded.                                                                                        |
| `500`  | [`internal_error`](/api/errors#internal_error)                                                                                     | Server error.                                                                                               |
