Skip to main content
PUT
/
expenses
/
{expense_id}
Update Expense
curl --request PUT \
  --url https://api.everhour.com/expenses/{expense_id} \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <api-key>' \
  --data '
{
  "amount": 2278,
  "attachments": [
    123
  ],
  "billable": true,
  "category": 236046,
  "date": "2019-04-04",
  "details": "Transportation notes",
  "project": "as:333045610521453",
  "quantity": 17,
  "user": 6
}
'
import requests

url = "https://api.everhour.com/expenses/{expense_id}"

payload = {
"amount": 2278,
"attachments": [123],
"billable": True,
"category": 236046,
"date": "2019-04-04",
"details": "Transportation notes",
"project": "as:333045610521453",
"quantity": 17,
"user": 6
}
headers = {
"X-Api-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 2278,
attachments: [123],
billable: true,
category: 236046,
date: '2019-04-04',
details: 'Transportation notes',
project: 'as:333045610521453',
quantity: 17,
user: 6
})
};

fetch('https://api.everhour.com/expenses/{expense_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.everhour.com/expenses/{expense_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 2278,
'attachments' => [
123
],
'billable' => true,
'category' => 236046,
'date' => '2019-04-04',
'details' => 'Transportation notes',
'project' => 'as:333045610521453',
'quantity' => 17,
'user' => 6
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Api-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.everhour.com/expenses/{expense_id}"

payload := strings.NewReader("{\n \"amount\": 2278,\n \"attachments\": [\n 123\n ],\n \"billable\": true,\n \"category\": 236046,\n \"date\": \"2019-04-04\",\n \"details\": \"Transportation notes\",\n \"project\": \"as:333045610521453\",\n \"quantity\": 17,\n \"user\": 6\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("X-Api-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://api.everhour.com/expenses/{expense_id}")
.header("X-Api-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 2278,\n \"attachments\": [\n 123\n ],\n \"billable\": true,\n \"category\": 236046,\n \"date\": \"2019-04-04\",\n \"details\": \"Transportation notes\",\n \"project\": \"as:333045610521453\",\n \"quantity\": 17,\n \"user\": 6\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.everhour.com/expenses/{expense_id}")

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

request = Net::HTTP::Put.new(url)
request["X-Api-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 2278,\n \"attachments\": [\n 123\n ],\n \"billable\": true,\n \"category\": 236046,\n \"date\": \"2019-04-04\",\n \"details\": \"Transportation notes\",\n \"project\": \"as:333045610521453\",\n \"quantity\": 17,\n \"user\": 6\n}"

response = http.request(request)
puts response.read_body
{
  "amount": 2278,
  "attachments": [
    {
      "id": 514,
      "name": "avatar.jpg",
      "token": "9a04b8a1fb99cbfadf3386ad6a338c14"
    }
  ],
  "billable": true,
  "category": 236046,
  "date": "2019-04-04",
  "details": "Transportation notes",
  "id": 234718,
  "project": "as:333045610521453",
  "quantity": 17,
  "user": 6
}

Authorizations

X-Api-Key
string
header
required

Path Parameters

expense_id
number
required

Expense ID

Example:

7810

Body

application/json
amount
integer

Amount in cents.

Example:

2278

attachments
integer[]

Attachment IDs to link.

billable
boolean
Example:

true

category
integer

Expense category ID

Example:

236046

date
string
Example:

"2019-04-04"

details
string
Example:

"Transportation notes"

project
string
Example:

"as:333045610521453"

quantity
number
Example:

17

user
integer
Example:

6

type
enum<string>

Expense type.

Available options:
separate,
billable,
cost

Response

OK

amount
integer
Example:

2278

attachments
object[]
billable
boolean
Example:

true

category
number
Example:

236046

date
string
Example:

"2019-04-04"

details
string
Example:

"Transportation notes"

id
number
Example:

234718

project
string
Example:

"as:333045610521453"

quantity
number
Example:

17

user
number
Example:

6