# Candidate routes: update, delete

URL: /code/api/candidate/records-update · Id: `page:code/api/candidate/records-update`

> The Candidate Verbs update, delete as api.sb routes, with inputs, result, refusals and an example.

Reference for [Candidate](/business/nouns/candidate), one group of [Candidate routes](/code/api/candidate).

### Candidate.update
Changes the given properties of a Candidate. [Verb page](/business/nouns/candidate/update?interface=api).

```text
PATCH /{namespace}/candidates/{id}
```

Path: `id`. Body, as JSON: the other inputs. Emits `Candidate.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Candidate. |
| `opening` | [Opening](/business/nouns/opening) | No | The Opening the Person is considered for. |
| `person` | [Person](/business/nouns/person) | No | The Person, whose record crosses Startups only with Consent. |
| `source` | `string` | No | One of `pool`, `prospecting`, `listing`, or `referral`. |
| `delta` | `json` | No | The per-Verb difference between the Candidate and the incumbent Agent in the tryout. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `candidate` | [Candidate](/business/nouns/candidate) | Yes | The Candidate. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X PATCH https://api.sb/leaseline.app/candidates/candidate_CR5hpwMwhW \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"opening":"opening_3rD8qFSOyQ"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "candidate": {
    "$id": "https://api.sb/leaseline.app/candidates/candidate_CR5hpwMwhW",
    "$type": "Candidate",
    "opening": "opening_3rD8qFSOyQ",
    "person": "person_sLqbXbW683",
    "source": "pool",
    "state": "screening"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Candidate.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Candidate.delete
Deletes a Candidate: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/candidate/delete?interface=api).

```text
DELETE /{namespace}/candidates/{id}
```

Path: `id`. Emits `Candidate.deleted`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Candidate. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `candidate` | [Candidate](/business/nouns/candidate) | Yes | The Candidate. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X DELETE https://api.sb/leaseline.app/candidates/candidate_CR5hpwMwhW \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "candidate": {
    "$id": "https://api.sb/leaseline.app/candidates/candidate_CR5hpwMwhW",
    "$type": "Candidate",
    "opening": "opening_3rD8qFSOyQ",
    "person": "person_sLqbXbW683",
    "source": "pool",
    "state": "screening"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Candidate.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```