clockPunch
Mutation Payroll API — POST https://payroll.api.gist.link/graphql
Toggle clock in/out by employee number (web or mobile). The caller must be the employee (token email match) or an org admin (kiosk mode).
Required permission
Section titled “Required permission”payroll:mutation:clockPunchThe calling IAM key must hold this permission (or a wildcard that covers it:
payroll:mutation:* or payroll:*) and the access token
must have been minted with audience=payroll. See
Permissions.
Definition
Section titled “Definition”type Mutation { clockPunch(employeeNumber: String!, source: String): TimeEntry!}Arguments
Section titled “Arguments”| Argument | Type | Required | Description |
|---|---|---|---|
employeeNumber |
String! |
Yes | — |
source |
String |
No | — |
Returns
Section titled “Returns”TimeEntry! — see the Payroll types reference.
Example
Section titled “Example”curl https://payroll.api.gist.link/graphql \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H 'Content-Type: application/json' \ -d @- <<'JSON' { "query": "mutation ClockPunch($employeeNumber: String!, $source: String) { clockPunch(employeeNumber: $employeeNumber, source: $source) { id uuid clock_in_at clock_out_at duration_seconds open source } }", "variables": { "employeeNumber": "example", "source": "example" } }JSONconst response = await fetch('https://payroll.api.gist.link/graphql', { method: 'POST', headers: { Authorization: `Bearer ${accessToken}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ query: `mutation ClockPunch($employeeNumber: String!, $source: String) { clockPunch(employeeNumber: $employeeNumber, source: $source) { id uuid clock_in_at clock_out_at duration_seconds open source } }`, variables: { "employeeNumber": "example", "source": "example" }, }),});
const { data, errors } = await response.json();if (errors) throw new Error(errors[0].message);console.log(data);<?php
$payload = json_encode([ 'query' => 'mutation ClockPunch($employeeNumber: String!, $source: String) { clockPunch(employeeNumber: $employeeNumber, source: $source) { id uuid clock_in_at clock_out_at duration_seconds open source } }', 'variables' => json_decode('{"employeeNumber":"example","source":"example"}', true),]);
$ch = curl_init('https://payroll.api.gist.link/graphql');curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $accessToken, 'Content-Type: application/json', ], CURLOPT_POSTFIELDS => $payload,]);
$result = json_decode(curl_exec($ch), true);curl_close($ch);
if (isset($result['errors'])) { throw new RuntimeException($result['errors'][0]['message']);}
var_dump($result['data']);import requests
response = requests.post( "https://payroll.api.gist.link/graphql", headers={ "Authorization": f"Bearer {access_token}", "Content-Type": "application/json", }, json={ "query": """mutation ClockPunch($employeeNumber: String!, $source: String) { clockPunch(employeeNumber: $employeeNumber, source: $source) { id uuid clock_in_at clock_out_at duration_seconds open source } }""", "variables": { "employeeNumber": "example", "source": "example" }, }, timeout=30,)body = response.json()if body.get("errors"): raise RuntimeError(body["errors"][0]["message"])print(body["data"])