You can now vote for scripts to help people know if they're useful or not. Login or create an account to vote!


Create a Tempo Account Using the REST API


Create a Tempo account (a way to track time across multiple teams and projects) using the Tempo REST API. Utilising the Tempo REST Endpoint, this script uses basic authentication in the headers of the request to authenticate the user. The authenticated user must have permission to create a Tempo account. Read more about permissions in Tempo in this article.


I want to automate the creation of Tempo accounts to save time manually creating them, and make issue progress easy to track. I can use this script to trigger a Tempo account creation each time an Epic is created. Allowing me to track the time spent on issue in that Epic.

Good to Know

  • This script requires Tempo Timesheets, Tempo Planner, or Tempo Budgets by Tempo for Jira.
  • API request credentials are stored as user properties. This property is named as basicAuthCreds and it contains user and password in the following format: <user>:<password>.
  • For an example of setting/getting user properties, see Library documentation


  • Jira Jira (7.7 - 8.6)
  • ScriptRunner for Jira ScriptRunner for Jira (5.6.14)
import com.atlassian.jira.component.ComponentAccessor import import import import import // the user-defined property where the user name and password are stored into final String userPropertyKey = "jira.meta.basicAuthCreds" def loggedInUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def credentials = ComponentAccessor.userPropertyManager.getPropertySet(loggedInUser).getString(userPropertyKey) def baseUrl = ComponentAccessor.applicationProperties.getString(APKeys.JIRA_BASEURL) def data = [ name : "Account", key : "12345", lead : [ key : "admin", username: "admin" ], status: "OPEN" ] def client = new RESTClient(baseUrl) client.encoderRegistry = new EncoderRegistry(charset: 'UTF-8') client.setHeaders([ Authorization : "Basic ${credentials.bytes.encodeBase64()}", "X-Atlassian-Token": "no-check" ]) client.handler.success = { response, json -> log.debug " Account successfully created" json['id'] } client.handler.failure = { HttpResponseDecorator response -> log.error response.entity.content.text } path: '/rest/tempo-accounts/1/account/', contentType: ContentType.JSON, body: data )
Discovered an issue? Report it here

Suggested for you

Appears in these Collections