Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Latest commit

 

History

History

README.md

Tock API documentation

⬅️ Back to Tock Documentation

Before you start

You'll need to have an API authorization token. Contact a Tock developer or ping the #tock-dev Slack channel for help.

Usage

You may issue GET requests to the various endpoints via the /api/ path; your results will be returned as JSON objects. We use Django REST Framework's TokenAuthentication library, which requires all requests to include a token value in the request header using the following format:

$ curl https://tock.18f.gov/api/projects.json -H 'Authorization: Token randomalphanumericstringed854b18ba024327'

This example uses a cURL command-line-based request for getting project data from our Tock deployment.

To access similar data in CSV format within Tock, please visit the /reports page.

Available Endpoints

  • Hours by quarter by user: Fetches an hourly summary of all submitted timecards by year, by quarter, and by user.
  • Hours by quarter: Fetches an hourly summary, by year and quarter, of all submitted timecards.
  • Project info: Fetches information about a specific project.
  • Projects: Fetches information about various projects.
  • Reporting period (audit specific time period): Fetches a list of all users who have not submitted a timecard for the specified period.
  • Reporting periods: Fetches a list of all available reporting periods and basic information about them.
  • Submissions by range: Fetches a list of users and a count of timecards submitted on or before the last day of each timecard's reporting period.
  • Timecards: Fetches a list of all submitted timecard objects and related information. Note that a "timecard object" here represents time a person spent on a given project. It's a more granular view of what someone worked on (compared to the "full timecards" endpoint, documented below).
  • Full timecards: Fetches a list of all timecards and related information. Note that a "timecard" here is different from a "timecard object" - a "timecard" is a higher level representation of what a person worked on during a reporting period, which could include many projects for varying periods of time, but that level of granularity is not captured here. If you want project-level data, don't use this endpoint - use the "Timecards" one above.
  • User data: Fetches a list of all users, along with organizational information for each.
  • Users: Fetches a list of all users, along with basic information about them.

Examples

Tock administrators and users use the Tock API in various ways. Here are two common examples of Tock API usage:


The Tock API documentation is written in GitHub-flavored markdown and is best read using the GitHub interface.