Take workers in from a Connection
If your workers are already registered in a source system such as Conneqtr, Dockt can read them from there. You connect the source, bind each site to a Workplace, and choose which workers to take in. Dockt then creates their Persons, employers, Assignments and files, and evaluates the work as usual.
Connections are available when Dockt has enabled them for your Account. Check connections_enabled with GET /v1/account.
You create and manage the Connection under /v1/account/connections. Binding sites, reading rosters and taking workers in use /v1/source-bindings, /v1/source-workers and /v1/source-intakes.
Before you begin
Section titled “Before you begin”Use a credential with account:read and account:write. Follow Authenticate your backend to set DOCKT_API_BASE_URL and DOCKT_API_TOKEN. These examples use curl and jq.
Create a Workplace for each source site by following Get started with Dockt. Set DOCKT_WORKPLACE_ID to the returned Workplace ID. Run the commands in the same shell.
Register a destination for decision.created by following Receive webhooks before you select workers.
1. Find the connector
Section titled “1. Find the connector”List the available source systems and their authentication methods:
curl --fail-with-body --silent --show-error \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ "$DOCKT_API_BASE_URL/v1/account/connectors" | jq '.data[] | {id, name, support_state, authentication_methods}'Conneqtr uses client_credentials: the client ID and secret of an API connection that a Conneqtr admin creates in Conneqtr, with the permissions they grant it.
2. Create the Connection
Section titled “2. Create the Connection”Replace the client ID and secret with the credentials created in Conneqtr, then send the request:
connection="$( curl --fail-with-body --silent --show-error \ -X POST "$DOCKT_API_BASE_URL/v1/account/connections" \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ -H 'Content-Type: application/json' \ --data '{ "provider": "conneqtr", "label": "Conneqtr production", "credentials": { "method": "client_credentials", "client_id": "REPLACE_WITH_CLIENT_ID", "client_secret": "REPLACE_WITH_CLIENT_SECRET" } }')"
export DOCKT_CONNECTION_ID="$(printf '%s' "$connection" | jq -r '.data.id')"printf '%s' "$connection" | jq '.data | {id, status, access_status, sites}'Dockt stores the credentials encrypted and tests them. Continue when access_status is ready. sites lists the Conneqtr construction sites the credentials can read.
If access_status is failed or reconnect_required, read last_error, fix the credentials in Conneqtr, and test again:
curl --fail-with-body --silent --show-error \ -X POST "$DOCKT_API_BASE_URL/v1/account/connections/$DOCKT_CONNECTION_ID/test" \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ -H 'Content-Type: application/json' \ --data '{}' | jq '.data | {access_status, last_error, sites}'Send new credentials in the test body to replace them. Testing refreshes the sites and imports nothing.
3. Bind a site to a Workplace
Section titled “3. Bind a site to a Workplace”Replace REPLACE_WITH_SITE_ID with an ID from the Connection’s sites list. The example uses the Workplace saved in DOCKT_WORKPLACE_ID:
curl --fail-with-body --silent --show-error \ -X POST "$DOCKT_API_BASE_URL/v1/source-bindings" \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ -H 'Content-Type: application/json' \ --data "$(jq -n --arg connection "$DOCKT_CONNECTION_ID" --arg workplace "$DOCKT_WORKPLACE_ID" '{ workplace: { id: $workplace }, connection: { id: $connection }, site: { id: "REPLACE_WITH_SITE_ID" } }')" | jq '.data | {id, workplace, site, sync}'A new Connection stays in draft after access testing. Binding the first site starts it: its status becomes active and the site’s first sync is scheduled immediately. A Connection whose site was bound before its access was ready stays in draft; start it yourself once access is ready:
curl --fail-with-body --silent --show-error \ -X PATCH "$DOCKT_API_BASE_URL/v1/account/connections/$DOCKT_CONNECTION_ID" \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ -H 'Content-Type: application/json' \ --data '{ "status": "active" }' | jq '.data | {id, status, access_status}'Dockt synchronizes bound sites on the active Connection’s schedule, every refresh_minutes. Change the schedule with PATCH /v1/account/connections/{connectionId} and refresh_minutes of 60, 360 or 1440. Binding another site to an already active Connection schedules that site’s first sync immediately.
A source roster lists everyone ever registered on the site, not only who works there now, so a site’s first read brings in its whole history. Dockt never takes that history in by itself: you choose. Select workers from the roster, or take them in in one go with POST /v1/source-bindings/{sourceBindingId}/intakes and a scope: on_site for those the source recorded on site lately, roster for everyone. Count them first with a GET on the same path; each worker taken in becomes a Person and is billed. on_site_months on the binding (1 to 6, default 1) is how long a worker counts as on site after their last check-in: it sets how far back “lately” reaches, and their work ends once they have stayed away for longer. With scope roster on a site that records check-ins, outside_window tells you how many of them are not on site: they are billed, and their work ends for absence.
A site feeds one Workplace at a time. Binding it to another Workplace while it is bound is a conflict; unbind it first with DELETE /v1/source-bindings/{sourceBindingId}.
4. Review the roster
Section titled “4. Review the roster”Syncing refreshes the roster without creating Persons, Companies, Assignments, or Documents. Wait for the binding’s sync.status to be succeeded; read it with GET /v1/source-bindings?workplace={workplaceId}. List the workers on the bound site:
curl --fail-with-body --silent --show-error \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ "$DOCKT_API_BASE_URL/v1/source-workers?workplace=$DOCKT_WORKPLACE_ID&active=true" \ | jq '.data[] | {id, first_name, last_name, company, identified, documents, intake: .intake.status}'activeistruewhile the worker was on the roster at the last sync.- A Conneqtr roster keeps everyone registered for the site, including workers who never came. Add
seen_on_site_since=YYYY-MM-DDto list only workers checked in on or after that date, andorder_by=last_on_siteto list the most recently present first. last_on_siteis the latest day the source recorded the worker on site, for sources that record presence (Conneqtr: check-ins). Once they have been away for the binding’son_site_months(a calendar month by default), their Assignment ends.identifiedistruewhen the source records an identity number Dockt can match the Person on.intakeis the latest intake, once you select the worker.
5. Take workers in
Section titled “5. Take workers in”Select 1 to 100 workers per request. Replace the example IDs with IDs returned by GET /v1/source-workers:
curl --fail-with-body --silent --show-error \ -X POST "$DOCKT_API_BASE_URL/v1/source-intakes" \ -H "Authorization: Bearer $DOCKT_API_TOKEN" \ -H 'Content-Type: application/json' \ --data '{ "source_workers": [{ "id": "swr_8Kd2" }, { "id": "swr_9Lp0" }] }' \ | jq '.data[] | {id, source_worker, status}'The response is 202 Accepted with one intake per worker in pending. For each worker, Dockt:
- Matches or creates the Person on the identity number the source records, kept only as a hash.
- Matches or creates the employer as a Company, deduplicated by registration number.
- Creates an Assignment at the bound Workplace, starting today.
- Uploads the worker’s files as Documents on the Person.
Read the worker list again to see each worker’s latest intake. When an intake is completed, it names the Person and Assignment. When it is failed, error says why, such as a contractor reference and VAT number that point to two different Companies. Dockt never merges Companies on its own.
6. Receive the Decisions
Section titled “6. Receive the Decisions”From here, the Assignments behave like any other. Dockt evaluates them and sends decision.created. The references in the event use the provider’s namespace, such as conneqtr.
Keep records current
Section titled “Keep records current”- Selecting a worker again after the source changed updates the same Person, Company and Assignment. Selecting an unchanged worker returns its existing intake.
- A sync doesn’t update records by itself. Select changed workers again to take the changes in.
- Intake never ends an Assignment. When a worker leaves the site, set the Assignment’s
period.end. POST /v1/account/connections/{connectionId}/syncsyncs every bound site now;POST /v1/source-bindings/{sourceBindingId}/syncsyncs one.
Pause or disconnect
Section titled “Pause or disconnect”PATCH /v1/account/connections/{connectionId}with"status": "paused"stops syncing every bound site. Setstatustoactiveto resume.DELETE /v1/account/connections/{connectionId}removes the credentials and stops syncing. Bindings, Persons, Assignments and files already taken in stay.POST /v1/account/connections/{connectionId}/testwith newcredentialsconnects a disconnected Connection again as adraft. Bind its sites again; the first bind starts it.
Conneqtr client secrets expire on a date set in Conneqtr. Replace the secret with POST /v1/account/connections/{connectionId}/test before then.