<!-- Generated by scripts/build-docs.js. Edit docs/swagger.yaml or docs/guides/, then run `npm run docs:build`. -->

# Transfer a user to an office

`POST https://marketplace-api.sequifi.com/v1/users/{id}/transfer`

Module: Users · operationId: `transferUser` · Auth: `Authorization: Bearer <token>`
Web page: https://apidocs.sequifi.com/#/api/transfer-user

Moves a user to another office from `effective_date`, either permanently or for a set window (for example a two-week blitz) after which they move back on their own. This changes pay: overrides on a sale follow the office the rep was in on the sale's approval date, so a transfer changes who earns overrides on the rep's sales from `effective_date` on. Try it on one or two reps before running it in bulk, and never change `effective_date` on a retry.

**Before you call:**

- `id` is the user id from `GET /v1/users` of an already-hired rep. For someone still in onboarding, set the office with `POST /v1/onboarding`.
- Get `office_id` from `GET /v1/locations`. Office names are not accepted.
- The rep must not be dismissed.

**What happens:**

- Permanent (no `end_date`): one office history entry dated `effective_date`.
- Temporary (`end_date` set): two entries, the move on `effective_date` and a move back to the rep's previous office on the day after `end_date`. The window includes `end_date`, so a one-day blitz uses the same date for both.
- Manager, team, department and state carry over from the rep's current assignment unless you send them. The rep keeps their own direct reports unless you send `existing_employee_new_manager_id`.
- Commission, override, upfront and redline values are not accepted. Sequifi works them out from the new office.
- A transfer dated today or earlier also recalculates the rep's open sales that are not fully paid.
- `team_id` changes the team shown on the rep's record but does not add the rep to that team's members, so the team manager's override does not follow. Change team membership in the app.
- `GET /v1/users/{id}` shows today's office, so a future-dated transfer does not appear there until its date.

**Idempotency and retries:**

- After a timeout, re-post the identical body. It updates the same entries instead of adding new ones and normally returns `200` again.
- For a rep with no earlier office history, a re-posted permanent transfer can return `409` `NO_CHANGE` instead. After a timeout, treat `NO_CHANGE` as success.
- For a rep with no earlier office history, re-posting a temporary transfer whose `effective_date` has already arrived can record the return to the temporary office instead of the original one. Check the rep's office history in the app before re-posting a temporary transfer.
- Never change `effective_date` on a retry. A different date is a second transfer.

**Formats:**

- Dates are `YYYY-MM-DD` and must be real calendar days. `end_date` must be on or after `effective_date`.
- `end_date` sent as `null` or `""` is the same as leaving it out, which makes the transfer permanent.
- Ids are positive integers; numeric strings also work. `null` or `""` for an optional id keeps the current value.
- Other body fields are ignored.
- The success response `status` is the number `200`.

**Errors:**

- `400` for an invalid path id, malformed JSON, or a missing or invalid field (messages in the examples).
- `404` `NOT_FOUND`: no user with that id.
- `409` `NO_CHANGE`: permanent transfer to the office the rep is already in on `effective_date`.
- `422` `USER_DISMISSED` (the rep is dismissed), `OFFICE_NOT_FOUND` (no office with that id, or it is archived; inactive offices are accepted), `TEAM_NOT_FOUND`, or `NO_RETURN_OFFICE` (temporary transfer for a rep with no earlier office to return to; leave out `end_date` instead).
- `500` `TRANSFER_FAILED` or `Could not resolve the tenant host`. Contact Sequifi support if it repeats.
- `502` `The tenant returned an unreadable response` or `Could not reach the tenant`: retry later with the identical body.
- `503`: your company is not set up for this endpoint yet. Contact Sequifi support.
- `504`: no answer in time. The transfer may still have been applied (see retries above).
- Error codes are in `data.code`, alongside `data.requestedBy`.
- `401` when the token is missing, malformed, expired or revoked. It is rejected before the request is processed, so the body is only `{"message":"Unauthorized"}`, with no `status` or `data`.

**Common mistakes:**

- Sending `end_date: ""` to mean "set later". It makes the move permanent.
- Sending a `manager_id` that is not a real user id. It is not checked and is saved as sent. Look managers up with `GET /v1/users`.
- Expecting the new office in `GET /v1/users/{id}` before `effective_date`.

**Related:**

- `GET /v1/locations` for `office_id`; `GET /v1/teams` for `team_id`.
- `POST /v1/users/{id}/position` to change position.

## Path parameters

- `id` (integer, **required**): User id of an already-hired rep, from `GET /v1/users`. Not an onboarding id. Minimum: 1. Example: `4821`.

## Request body

- `office_id` (integer, **required**): Target office, from `GET /v1/locations`. Must not be archived. Minimum: 1. Example: `31`.
- `effective_date` (string (date), **required**): First day the rep works out of the target office, YYYY-MM-DD. Example: `2026-08-11`.
- `end_date` (string (date), nullable): Last day of a temporary transfer, inclusive. Leave it out for a permanent move. Must be on or after `effective_date`. Example: `2026-08-22`.
- `manager_id` (integer, nullable): New manager's user id. Defaults to the rep's current manager. Not checked for existence. Minimum: 1. Example: `87`.
- `team_id` (integer, nullable): New team id. Defaults to the rep's current team. Changes the team label only, not team membership. Minimum: 1. Example: `4`.
- `existing_employee_new_manager_id` (integer, nullable): Who the rep's own direct reports answer to afterwards. Defaults to the rep, so they keep their team, which is usually right for a temporary transfer. Send it only to hand the reports to someone else. Minimum: 1. Example: `87`.

Example (permanent): Permanent transfer

```json
{
  "office_id": 31,
  "effective_date": "2026-08-11"
}
```

Example (blitz): Two-week blitz, moves back automatically

```json
{
  "office_id": 31,
  "effective_date": "2026-08-11",
  "end_date": "2026-08-22"
}
```

## Example request

```bash
curl -X POST "https://marketplace-api.sequifi.com/v1/users/4821/transfer" \
  -H "Authorization: Bearer $SEQUIFI_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"office_id":31,"effective_date":"2026-08-11"}'
```

## Responses

### 200: Transfer applied

- `status` (integer): The HTTP status code, repeated. Example: `200`.
- `message` (string): Short text. Wording varies by endpoint; branch on the HTTP status, not on this text. Example: `success`.
- `data` (object)
  - `requestedBy` (string): Name of the API credential your token belongs to.
  - `user_id` (integer): The transferred user.
  - `temporary` (boolean): True when `end_date` was sent.
  - `transfers` (array of object): Every office history entry written, in date order. One for a permanent transfer, two for a temporary one.
    - `office_id` (integer): Office from this date.
    - `effective_date` (string (date)): Date the entry takes effect, YYYY-MM-DD.
  - `returns_to_office_id` (integer, nullable): Office the rep moves back to after a temporary transfer. Null for a permanent one.

Example (temporary): Temporary transfer applied

```json
{
  "status": 200,
  "message": "Temporary transfer applied.",
  "data": {
    "requestedBy": "acme",
    "user_id": 4821,
    "temporary": true,
    "transfers": [
      {
        "office_id": 31,
        "effective_date": "2026-08-11"
      },
      {
        "office_id": 19,
        "effective_date": "2026-08-23"
      }
    ],
    "returns_to_office_id": 19
  }
}
```

Example (permanent): Permanent transfer applied

```json
{
  "status": 200,
  "message": "Transfer applied.",
  "data": {
    "requestedBy": "acme",
    "user_id": 4821,
    "temporary": false,
    "transfers": [
      {
        "office_id": 31,
        "effective_date": "2026-08-11"
      }
    ],
    "returns_to_office_id": null
  }
}
```

### 400: Invalid id, body or field

Example (invalid_id): Path id is not a positive whole number

```json
{
  "status": 400,
  "message": "Invalid user id",
  "data": {}
}
```

### 401: Missing, malformed, expired or revoked token. Rejected before processing, so the body has only `message`.

```json
{
  "message": "Unauthorized"
}
```

### 404: No user with that id

```json
{
  "status": 404,
  "message": "No user with id 4821.",
  "data": {
    "requestedBy": "acme",
    "code": "NOT_FOUND"
  }
}
```

### 409: The rep is already in that office on `effective_date` and no `end_date` was sent. After a timed-out first attempt, treat this as success.

```json
{
  "status": 409,
  "message": "User 4821 is already assigned to office 31 as of 2026-08-11.",
  "data": {
    "requestedBy": "acme",
    "code": "NO_CHANGE"
  }
}
```

### 422: The rep, office or team cannot be used

Example (user_dismissed): The rep is dismissed

```json
{
  "status": 422,
  "message": "User 4821 is dismissed and cannot be transferred.",
  "data": {
    "requestedBy": "acme",
    "code": "USER_DISMISSED"
  }
}
```

### 500: The transfer could not be applied

```json
{
  "status": 500,
  "message": "The transfer could not be applied.",
  "data": {
    "requestedBy": "acme",
    "code": "TRANSFER_FAILED"
  }
}
```

### 502: Sequifi could not complete the request. Retry later with the identical body.

```json
{
  "status": 502,
  "message": "Could not reach the tenant",
  "data": {
    "user_id": 4821
  }
}
```

### 503: Your company is not set up for transfers over the API. Contact Sequifi support; this is not a problem with your token.

Example (not_configured): Not configured

```json
{
  "status": 503,
  "message": "This tenant is not configured for transfers over the API. Contact Sequifi support.",
  "data": {}
}
```

### 504: No answer in time. The transfer may still have been applied; re-post the identical body.

```json
{
  "status": 504,
  "message": "The tenant did not respond in time. The transfer may still have been applied — re-post the identical body, which converges rather than transferring twice. Do not change effective_date on a retry.",
  "data": {
    "user_id": 4821
  }
}
```
