# Log, list, edit and delete Jira worklogs with the REST API

URL: https://goingstellar.ro/reference/atlassian-rest-api/worklogs/

Time is logged with POST /rest/api/3/issue/{issueIdOrKey}/worklog, read with GET on the same path, and changed or removed through /worklog/{id}. A worklog needs either timeSpent in Jira notation or timeSpentSeconds. The started timestamp has a single accepted format, and a trailing Z is refused.

## Endpoints

| Method | Path | What it does |
|---|---|---|
| POST | `/rest/api/3/issue/{issueIdOrKey}/worklog` | Adds a worklog. |
| GET | `/rest/api/3/issue/{issueIdOrKey}/worklog` | Lists the worklogs of a work item. |
| PUT | `/rest/api/3/issue/{issueIdOrKey}/worklog/{id}` | Updates a worklog. |
| DELETE | `/rest/api/3/issue/{issueIdOrKey}/worklog/{id}` | Deletes a worklog. |

## Examples

### POST /rest/api/3/issue/{issueIdOrKey}/worklog

Logs 1h 30m with an ADF comment and a started time written with a +0000 offset.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "timeSpent": "1h 30m",
  "started": "2026-11-29T09:00:00.000+0000",
  "comment": {
    "type": "doc",
    "version": 1,
    "content": [
      {
        "type": "paragraph",
        "content": [
          {
            "type": "text",
            "text": "Investigated the bug."
          }
        ]
      }
    ]
  }
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'timeSpent': '1h 30m',
          'started': '2026-11-29T09:00:00.000+0000',
          'comment': {'type': 'doc',
                      'version': 1,
                      'content': [{'type': 'paragraph',
                                   'content': [{'type': 'text',
                                                'text': 'Investigated the bug.'}]}]}},
)
print(r.status_code, r.text)
```

Response: HTTP 201

```
{
 "comment": {
  "type": "doc",
  "version": 1,
  "content": [
   {
    "type": "paragraph",
    "content": [
     {
      "type": "text",
      "text": "Investigated the bug."
     }
    ]
   }
  ]
 },
 "started": "2026-11-29T11:00:00.000+0200",
 "timeSpent": "1h 30m",
 "timeSpentSeconds": 5400,
 "id": "10000",
 "issueId": "10766"
}
```

Response headers:

```
X-Ratelimit-Limit: 200
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/issue/{issueIdOrKey}/worklog

Logs 900 seconds with no comment. Jira derives the timeSpent text itself.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "timeSpentSeconds": 900,
  "started": "2026-11-29T11:00:00.000+0000"
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'timeSpentSeconds': 900, 'started': '2026-11-29T11:00:00.000+0000'},
)
print(r.status_code, r.text)
```

Response: HTTP 201

```
{
 "started": "2026-11-29T13:00:00.000+0200",
 "timeSpent": "15m",
 "timeSpentSeconds": 900,
 "id": "10001"
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### POST /rest/api/3/issue/{issueIdOrKey}/worklog

Sends started with a Z suffix and no milliseconds. The format is rejected with the exact pattern in the message.

```bash
curl -X POST \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "timeSpent": "1h",
  "started": "2026-11-29T09:00:00Z"
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.post(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'timeSpent': '1h', 'started': '2026-11-29T09:00:00Z'},
)
print(r.status_code, r.text)
```

Response: HTTP 400

```
{
 "errorMessages": [],
 "errors": {
  "started": "Invalid date format. Please enter the date in the format \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\"."
 }
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### GET /rest/api/3/issue/{issueIdOrKey}/worklog

Lists the worklogs on the work item. The page size reported is 5000.

```bash
curl \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.get(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "startAt": 0,
 "maxResults": 5000,
 "total": 2,
 "worklogs": [
  {
   "started": "2026-11-29T11:00:00.000+0200",
   "timeSpent": "1h 30m",
   "timeSpentSeconds": 5400,
   "id": "10000"
  },
  {
   "started": "2026-11-29T13:00:00.000+0200",
   "timeSpent": "15m",
   "timeSpentSeconds": 900,
   "id": "10001"
  }
 ]
}
```

Sent to Atlassian Cloud on 29 Nov 2026.

### PUT /rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}

Changes only timeSpent. The comment and started time stay as they were.

```bash
curl -X PUT \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{
  "timeSpent": "2h"
}' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.put(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    json={'timeSpent': '2h'},
)
print(r.status_code, r.text)
```

Response: HTTP 200

```
{
 "comment": {
  "type": "doc",
  "version": 1,
  "content": [
   {
    "type": "paragraph",
    "content": [
     {
      "type": "text",
      "text": "Investigated the bug."
     }
    ]
   }
  ]
 },
 "updated": "2026-11-29T19:30:08.437+0200",
 "started": "2026-11-29T11:00:00.000+0200",
 "timeSpent": "2h",
 "timeSpentSeconds": 7200,
 "id": "10000"
}
```

Response headers:

```
X-Ratelimit-Limit: 300
```

Sent to Atlassian Cloud on 29 Nov 2026.

### DELETE /rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}

Deletes a worklog and leaves the remaining estimate alone with adjustEstimate=leave.

```bash
curl -X DELETE \
  -u "you@example.com:$ATLASSIAN_API_TOKEN" \
  -H 'Accept: application/json' \
  'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}?adjustEstimate=leave'
```

```python
import os
import requests

EMAIL = "you@example.com"
r = requests.delete(
    'https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/worklog/{worklogId}?adjustEstimate=leave',
    auth=(EMAIL, os.environ["ATLASSIAN_API_TOKEN"]),
    headers={'Accept': 'application/json'},
    params={'adjustEstimate': 'leave'},
)
print(r.status_code, r.text)
```

Response: HTTP 204

No response body.

Sent to Atlassian Cloud on 29 Nov 2026.

## How it behaves

- started was sent as 2026-11-29T09:00:00.000+0000 and came back as 2026-11-29T11:00:00.000+0200. It is the same instant written in the offset of the calling user, whose time zone the user record gives as Europe/Bucharest.
- timeSpent "1h 30m" became timeSpentSeconds 5400, and timeSpentSeconds 900 became timeSpent "15m". Both fields are filled in on the response whichever one was sent.
- started with a Z suffix gave 400 with errors.started set to a message that spells out the pattern yyyy-MM-dd'T'HH:mm:ss.SSSZ.
- PUT with only {"timeSpent": "2h"} returned 200 with the comment and started values unchanged and a new updated timestamp, so the update is partial.
- DELETE with adjustEstimate=leave answered 204 with no body. The spec lists new, leave, manual and auto for this parameter, with auto as the default on POST.

## Pitfalls

- Write started as yyyy-MM-dd'T'HH:mm:ss.SSSZ with a numeric offset such as +0000. ISO strings ending in Z are the common mistake.
- Do not read the offset in the response as a bug. It is the caller's zone, not the zone that was sent.
- The estimate changes with every add unless adjustEstimate says otherwise. The spec default is auto, which reduces the remaining estimate by timeSpent.
- Expect the list to be paged as well. The response reports startAt, maxResults and total for it.

## Questions and answers

### Which timestamp format does started accept?

yyyy-MM-dd'T'HH:mm:ss.SSSZ, for example 2026-11-29T09:00:00.000+0000. A value ending in Z returned 400 with that pattern in the message.

### Can I send timeSpent and timeSpentSeconds together?

The runs sent one at a time and both were accepted. No run sent both, so the combined behaviour is untested.

## Related

- [Comments](https://goingstellar.ro/reference/atlassian-rest-api/issue-comments/)
- [Global configuration](https://goingstellar.ro/reference/atlassian-rest-api/jira-configuration/)
- [ADF in request bodies](https://goingstellar.ro/reference/atlassian-rest-api/adf-in-request-bodies/)
- [Get a work item](https://goingstellar.ro/reference/atlassian-rest-api/get-issue/)

## Sources

- [The Jira Cloud platform REST API v3 (Atlassian Developer)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/)
- [Add worklog (Jira REST API v3)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-worklogs/#api-rest-api-3-issue-issueidorkey-worklog-post)

