# Get shift details

GET https://api.letsdeel.com/rest/v2/time_tracking/shifts/{external_id}

Retrieve details of a specific shift by external ID.
 **Token scopes**: `time-tracking:read`

Reference: https://developer.deel.com/api/endpoints/time-tracking-shifts/get-time-tracking-shift-by-external-id

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Deel HRIS SCIM API
  version: 1.0.0
paths:
  /time_tracking/shifts/{external_id}:
    get:
      operationId: get-time-tracking-shift-by-external-id
      summary: Get shift details
      description: |-
        Retrieve details of a specific shift by external ID.
         **Token scopes**: `time-tracking:read`
      tags:
        - subpackage_timeTrackingShifts
      parameters:
        - name: external_id
          in: path
          description: Unique identifier of the shift to retrieve.
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: >
            ## Authentication

            The Deel API uses bearer tokens to authenticate requests. All API
            calls must be made over HTTPS — calls over plain HTTP or without
            authentication will fail.


            ```curl

            curl -X GET 'https://api.letsdeel.com/rest/v2/contracts' \
              -H 'Authorization: Bearer YOUR-TOKEN-HERE'
            ```


            [Learn more about authentication](/api/authentication)
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Shift details retrieved successfully
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/time-tracking-shifts_getTimeTrackingShiftByExternalId_Response_200
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetShiftDetailsRequestBadRequestError'
        '401':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '403':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '404':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
        '500':
          description: Operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
servers:
  - url: https://api.letsdeel.com/rest/v2
  - url: https://api-staging.letsdeel.com/rest/v2
components:
  schemas:
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaEnd:
      type: object
      properties:
        date:
          type: string
          description: End date of the shift.
        time:
          type: string
          description: End time of the shift.
        is_rest_day:
          type: boolean
          description: Indicates if the shift end day is a rest day.
        is_public_holiday:
          type: boolean
          description: Indicates if the shift end day is a public holiday.
      description: End time details of the shift.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaEnd
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaStart:
      type: object
      properties:
        date:
          type: string
          description: Start date of the shift.
        time:
          type: string
          description: Start time of the shift.
        is_rest_day:
          type: boolean
          description: Indicates if the shift start day is a rest day.
        is_public_holiday:
          type: boolean
          description: Indicates if the shift start day is a public holiday.
      description: Start time details of the shift.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaStart
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItemsEnd:
      type: object
      properties:
        date:
          type: string
          description: Break end date.
        time:
          type: string
          description: Break end time.
      description: End time details of the break.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItemsEnd
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItemsStart:
      type: object
      properties:
        date:
          type: string
          description: Break start date.
        time:
          type: string
          description: Break start time.
      description: Start time details of the break.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItemsStart
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItems:
      type: object
      properties:
        end:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItemsEnd
          description: End time details of the break.
        start:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItemsStart
          description: Start time details of the break.
        is_paid:
          type: boolean
          description: Indicates if the break is paid.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItems
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMeta:
      type: object
      properties:
        end:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaEnd
          description: End time details of the shift.
        start:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaStart
          description: Start time details of the shift.
        breaks:
          type: array
          items:
            $ref: >-
              #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMetaBreaksItems
          description: List of break periods within the shift.
        approval_date:
          type: string
          description: Approval date of the shift.
      description: >-
        Metadata containing detailed information about the shift timing, breaks,
        and approval status.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMeta
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataSummary:
      type: object
      properties:
        total_break_hours:
          type: number
          format: double
          description: Total break hours within the shift.
        payable_break_hours:
          type: number
          format: double
          description: Total payable break hours.
        total_payable_hours:
          type: number
          format: double
          description: Total payable hours for the shift.
        shift_duration_hours:
          type: number
          format: double
          description: Total duration of the shift in hours.
        shift_rate_external_id:
          type: string
          description: External ID of the shift rate associated with the shift.
      description: Summary of calculated hours and rates for the shift.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataSummary
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataPayrollCycleRef:
      type: object
      properties:
        date:
          type: string
          description: Date in ISO 8601 format that helps referencing a payroll cycle
      required:
        - date
      description: Reference to the payroll cycle associated with this shift.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataPayrollCycleRef
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaData:
      type: object
      properties:
        meta:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataMeta
          description: >-
            Metadata containing detailed information about the shift timing,
            breaks, and approval status.
        summary:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataSummary
          description: Summary of calculated hours and rates for the shift.
        created_at:
          type: string
          description: Timestamp when the shift was created.
        updated_at:
          type: string
          description: Timestamp when the shift was last updated.
        contract_id:
          type: string
          description: Contract ID associated with the shift.
        description:
          type: string
          description: Description of the shift.
        external_id:
          type: string
          description: Unique identifier of the shift.
        date_of_work:
          type: string
          description: The date of work for the shift.
        payroll_cycle_ref:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaDataPayrollCycleRef
          description: Reference to the payroll cycle associated with this shift.
      description: Shift record details.
      title: TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaData
    time-tracking-shifts_getTimeTrackingShiftByExternalId_Response_200:
      type: object
      properties:
        data:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaData
          description: Shift record details.
      required:
        - data
      title: time-tracking-shifts_getTimeTrackingShiftByExternalId_Response_200
    TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaError:
      type: object
      properties:
        message:
          type: string
          description: Description of the error.
      title: >-
        TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaError
    GetShiftDetailsRequestBadRequestError:
      type: object
      properties:
        error:
          $ref: >-
            #/components/schemas/TimeTrackingShiftsExternalIdGetResponsesContentApplicationJsonSchemaError
      title: GetShiftDetailsRequestBadRequestError
    ApiErrorRequest:
      type: object
      properties:
        method:
          type: string
          description: The HTTP method of the failed request
        url:
          type: string
          description: The relative URL of the failed request
        status:
          type: number
          format: double
          description: The status code of the response
        api_req_id:
          type: string
          description: The request ID of the failed request
        docs:
          type: string
          description: >-
            A link to the official documentation for the requested endpoint
            resource
        source:
          type: string
          description: The source handler which produced the returned error
        code:
          type: number
          format: double
          description: The code of the source handler which produced the returned error
      title: ApiErrorRequest
    ApiError:
      type: object
      properties:
        message:
          type: string
          description: A description of the returned error
        path:
          type: string
          description: The JSON path where input validation failed
      title: ApiError
    ApiErrorContainer:
      type: object
      properties:
        request:
          $ref: '#/components/schemas/ApiErrorRequest'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiError'
      title: ApiErrorContainer
  securitySchemes:
    deelToken:
      type: http
      scheme: bearer
      description: >
        ## Authentication

        The Deel API uses bearer tokens to authenticate requests. All API calls
        must be made over HTTPS — calls over plain HTTP or without
        authentication will fail.


        ```curl

        curl -X GET 'https://api.letsdeel.com/rest/v2/contracts' \
          -H 'Authorization: Bearer YOUR-TOKEN-HERE'
        ```


        [Learn more about authentication](/api/authentication)
    oauth2:
      type: http
      scheme: bearer
      description: >-
        Standard OAuth2 security scheme based on
        https://swagger.io/docs/specification/authentication/

```

## SDK Code Examples

```python
import requests

url = "https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.letsdeel.com/rest/v2/time_tracking/shifts/shift_1234567dewdwe")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```