# Workflow

This is the full life of a job in the JobLauncher API, from the first call to closing it. If you just want to make your first call, start with [Getting Started](https://connect.equest.com/joblauncher-api/docs/getting-started). Come back here when you're designing the full integration.

## How it fits together

![JobLauncher API posting workflow: your system creates a draft, gets boards, adds board specific data if needed, and posts to boards. eQuest delivers to each board, sends status back by webhook, and updates or closes the job on request.](https://tools.equest.com/images/joblauncher-workflow.png)

[Open the full size diagram](https://tools.equest.com/images/joblauncher-workflow.png)

| Step | What you do | Call | What you get back |
| --- | --- | --- | --- |
| 1 | Send the job data | `POST /drafts` | `201` with the draft and its ID |
| 2 | See which boards you can use | `GET /boards` | Board IDs, inventory left, and which boards need extra fields |
| 3 | Fill in extra board fields, if any board needs them | `GET /drafts/{draft_id}/bsd` | A link to an eQuest page where your user fills them in |
| 4 | Post to boards | `POST /drafts/{draft_id}/postings` | `202` and the job ID in the `Location` header |
| 5 | Track delivery | `GET /jobs/{job_id}/postings` or webhooks | Status and live URL for each board |
| 6 | Update the job, if it changes | New draft, same requisition number | Postings updated in place |
| 7 | Close it | `DELETE /jobs/{job_id}` | The job comes down from every board |

## Drafts and jobs

There are two kinds of objects, and it helps to keep them straight.

| Object | What it is | How long it lives |
| --- | --- | --- |
| **Draft** | The job data, before any board is picked. Holds the title, description, location, company, and so on. | Single use. Once you post it, it's used up. |
| **Job** | Created the first time a draft is posted to at least one board. Holds one **posting** per board. | Until you close it, or every posting expires. |

There's no call that creates a job directly. A job only exists once it's on at least one board.

## Two ways to integrate

Users can pick boards in eQuest's own screens (**interactive**) or in screens you build (**non-interactive**). **We strongly recommend interactive.** It's less to build and maintain, and you'd need to send users to an eQuest page for board specific data anyway. See [Integration Approach](https://connect.equest.com/joblauncher-api/docs/integration-approach) to compare them.

The steps below describe the non-interactive approach, since it uses every call. With the interactive approach, you do step 1, send the user to the `board:select-form` link, and pick up again at step 5.

## Step 1: Send the job data

Call `POST /drafts` with the job. You get back a `201` with the draft, including its `id`. The `Location` header has the same draft URL.

-   Leave a field out to use the default on your eQuest account. Send it empty if you want it blank.
-   Always send your own `requisition_number`. It's how you find the job later and how updates are matched.
-   Set `webhook_url` here if you want status updates pushed to you. See [Webhooks](https://connect.equest.com/joblauncher-api/docs/webhooks).
-   Set `return_url` to the page in your app where users should land after they finish anything in eQuest's screens.

### Customers who use Force Review

Some eQuest customers set up **job field rules** that flag certain fields for a recruiter to review before a job posts. If the customer uses this and has API support for it turned on (eQuest Support turns it on), the `201` response changes:

| Setup | Link in `_links` | What to do |
| --- | --- | --- |
| Normal | `board:select-form` | Carry on with step 2. |
| Force Review turned on | `draft:edit-form` | Send the user to that link. They review the flagged fields in eQuest, then carry on. |

The same `draft:edit-form` link also comes back with a `400` when the job data has errors. See [Errors and Troubleshooting](https://connect.equest.com/joblauncher-api/docs/errors-and-troubleshooting).

## Step 2: Pick the boards

Call `GET /boards` to get the boards on the account. For each board you'll see:

| Field | Why it matters |
| --- | --- |
| `id` | What you send in step 4. |
| `inventory` | How many postings are left. If a board is out, step 4 returns `403`. |
| `bsd_required` | If `true`, the board needs extra fields first. See step 3. |
| `auto_repost_enabled` | If `true`, you can ask eQuest to repost automatically when it expires. |

Most integrations show this list to the user so they can check off the boards they want.

## Step 3: Extra board fields (only some boards)

Some boards need fields that aren't part of the standard job. For example, the API takes a state and city, but a board might also require a neighborhood. eQuest calls this **board specific data**. Without it, the board may not accept the job.

1.  Call `GET /drafts/{draft_id}/bsd` with the IDs of those boards and a `return_url`.
2.  Send your user to the URL you get back, with a note that the board needs a bit more information. The link only works once and only for this draft. They fill in the fields on an eQuest page.
3.  eQuest sends them back to your `return_url`.
4.  Carry on with step 4.

If none of the chosen boards show `bsd_required: true`, skip this step.

## Step 4: Post to boards

Call `POST /drafts/{draft_id}/postings` with a list of boards. Each one can have its own `posting_instructions`:

| Instruction | What it does |
| --- | --- |
| Nothing (`{}`) | Posts right away with the defaults. |
| `scheduled_at` | Waits and posts at that time. |
| `unpost_at` | Takes it down from that board at that time. |
| `auto_repost` | Reposts when it expires, on boards that support it. |
| `webhook_url` | Sends status updates for this board to a different URL than the draft's. |

A `202` means eQuest accepted it, created the job, and queued delivery. The job URL is in the `Location` header, and the job ID is the number at the end.

> **Billing:** each call to this endpoint is one transaction. Send every board in a single call.

## Step 5: Track delivery

Each board gets its own posting, and each posting moves through these states:

| State | Meaning | What to do |
| --- | --- | --- |
| `queued` | eQuest has it and is sending it to the board. | Nothing. Usually takes seconds to minutes. |
| `scheduled` | Waiting for its `scheduled_at` time. | Nothing. |
| `posted` | Live on the board. | Show `live_url` to your user. |
| `deferred` | The board didn't accept it. | Read `deferred_reason`, fix the job data, and post it again. |
| `expired` | No longer live on the board. | Repost it if the job is still open. |

There are two ways to keep up:

| Option | How | Best for |
| --- | --- | --- |
| **Webhooks** | eQuest calls your `webhook_url` each time a posting changes. | Most integrations. Nothing to schedule, and updates arrive right away. |
| **Polling** | Call `GET /jobs/{job_id}/postings` on a schedule. | Systems that can't receive incoming calls, or catching up after your webhook endpoint was down. |

## Step 6: Update a job

Drafts are single use, so you don't edit a job directly. Instead:

1.  Create a new draft with the **same** `**requisition_number**` and the updated data.
2.  Post it to the same boards.

eQuest matches it to the existing job by requisition number. For each board:

| If the posting is... | eQuest... |
| --- | --- |
| Live | Updates it in place. |
| Expired | Reposts it. |
| Not on that board yet | Creates a new posting there. |

Each update counts against the customer's inventory on every board the job is on, because eQuest has to send the change to each board. It's worth warning your users before they update a live job.

## Step 7: Take it down

| You want to... | Call |
| --- | --- |
| Close the job everywhere | `DELETE /jobs/{job_id}` |
| Pull it from one board but leave it on the others | `DELETE /jobs/{job_id}/postings/{posting_id}` |
| Have it come down on its own at a set time | Send `unpost_at` on the draft (all boards) or in `posting_instructions` (one board) |

Taking a job down early also counts against the customer's inventory, because eQuest has to tell each board to remove it before its normal end date. Warn your users before they close a job early.

## Finding a job later

If you didn't save the job ID, look it up by your requisition number:

```text
GET /jobs?requisition_number=REQ-20418
```

Add `include_deleted=true` to also see jobs that were closed.

## Checklist for a production integration

-   Every job sends a unique, stable `requisition_number`.
-   All boards go in one postings call, not one call per board.
-   Boards with `bsd_required: true` go through the board specific data step.
-   Your user can see each board's state, plus `deferred_reason` when one fails.
-   Updates reuse the requisition number instead of creating a new job.
-   Closing a job in your system calls `DELETE /jobs/{job_id}`.
-   Every request sends `X-Accept-Version`.
