---
title: "Rebind By Path"
method: PUT
path: "/datamate-project-bindings/by-path"
tags: ["DatamateProjectBindings"]
---

# Rebind By Path

`PUT /datamate-project-bindings/by-path`

Path-identified rebind — symmetric to ``PUT /by-remote`` for projects
without a git remote (materialized sample scaffolds, fresh scratch dirs).
Same ``FOR UPDATE`` + optimistic-concurrency semantics as its remote
sibling, same both-sides authorization, same in-place mutation of the
binding row.

Path-only bindings are scoped by user, so the ``FOR UPDATE`` lookup passes
the caller's ``user_id`` — a coincidentally-matching path belonging to
another user will simply 404.

## Request body

- RebindByPathRequest — Body for PUT /datamate-project-bindings/by-path (atomic re-link). Symmetric to ``RebindByRemoteRequest`` but keyed on the project's absolute directory path — used when the project has no git remote (sample scaffolds, fresh scratch dirs). Mutates the binding row in place; ``created_at`` reflects the original binding (consensus review m5).
  - `project_path` string, required
  - `target_datamate_id` integer, required
  - `expected_current_datamate_id` integer, nullable

## Response `200`

Successful Response

- BindingResponse — Response for the bind-existing and rebind endpoints.
  - `binding` BindingModel, required — Wire shape returned to the CLI for a single binding row. Either ``repo_remote`` or ``project_path`` is present (at least one; the row's CHECK constraint enforces this). Projects with a git remote use ``repo_remote``; projects without one (materialized sample scaffolds, fresh scratch dirs) use ``project_path`` as the fallback identifier.
    - `id` integer, required
    - `datamate_id` integer, required
    - `datamate_name` string, required
    - `repo_remote` string, nullable
    - `project_path` string, nullable
    - `created_at` string, date-time, nullable

## Other responses

- `400` — Invalid request
- `403` — Not the current or target owner
- `404` — No existing binding for this path
- `412` — Current binding does not match expected_current_datamate_id
- `422` — Validation Error

---

[API](https://skmtc.net/myaltimate/apis/fastapi.md) · [All operations](https://skmtc.net/myaltimate/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/myaltimate/fastapi/revisions/b9cc757ca795/schema)
