# Payhawk

> Create, review and pay expenses in Payhawk, manage suppliers, cards, users and custom field values, read bank statements, and follow new expenses, payments and cards.

App · 25 actions. Web page: https://docs.lodol.com/docs/integrations/payhawk

## Actions

### Archive or restore supplier

Archive a supplier so it can't be chosen, or make an archived one active again.

**Inputs**

- Supplier (`supplier_id`, text, required): The supplier.
- Set to (`status`, text, required): Archived or active. One of: `archived`, `active`.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "address": "example",
    "contactEmail": "example",
    "contactName": "example",
    "contactPhone": "example",
    "countryCode": "example",
    "externalId": "example",
    "externalSource": "example",
    "id": "example",
    "name": "example",
    "status": "example",
    "taxId": "example",
    "uic": "example",
    "vat": "example"
  }
}
```

### Create custom field value

Add a value people can choose for a list custom field, such as a new project or cost center.

**Inputs**

- Custom field (`custom_field_id`, text, required): The custom field.
- Name (`label`, text, required): The value's name.
- External ID (`external_id`, text): The value's ID in your accounting or ERP system.
- Parent value ID (`parent_id`, text): The ID of the value this one sits under, for nested lists.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "externalId": "example",
    "id": "example",
    "label": "example",
    "parentId": "example"
  }
}
```

### Create expense

Create a bill, reimbursable or cash expense for a user, ready for them to add a receipt and submit.

**Inputs**

- Type (`type`, text, required): The kind of expense. One of: `bank` (Bill (paid by bank transfer)), `reimbursable` (Reimbursable (paid by the employee)), `cash`.
- User (`created_by`, text, required): The user the expense is for.
- Total amount (`total_amount`, number): The total amount, including tax. At least 0.
- Tax amount (`tax_amount`, number): The tax included in the total. At least 0.
- Currency (`currency`, text): The amount's currency, as a three-letter code such as EUR.
- Category (`category_id`, text): The expense category.
- Supplier (`supplier_id`, text): The supplier.
- Document number (`document_number`, text): The invoice or receipt number.
- Note (`note`, text): A note about the expense.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "approvalProcess": {
          "status": "example",
          "submittedAt": "example"
        },
        "category": {
          "fullName": "example",
          "id": "example",
          "name": "example"
        },
        "createdAt": "example",
        "createdBy": {
          "email": "example",
          "externalId": "example",
          "firstName": "example",
          "id": "example",
          "lastName": "example"
        },
        "document": {
          "documentDate": "example",
          "documentNumber": "example",
          "documentType": "example"
        },
        "id": "example",
        "isPaid": true,
        "modifiedAt": "example",
        "note": "example",
        "owner": {
          "email": "example",
          "externalId": "example",
          "firstName": "example",
          "id": "example",
          "lastName": "example"
        },
        "reconciliation": {
          "baseCurrency": "example",
          "baseTotalAmount": 1,
          "currency": "example",
          "taxAmount": 1,
          "totalAmount": 1
        },
        "reviewedAt": "example",
        "settledAt": "example",
        "status": "example",
        "supplier": {
          "id": "example",
          "name": "example"
        },
        "title": "example",
        "type": "example"
      }
    ],
    "total": 1
  }
}
```

### Create supplier

Add a supplier to the account.

**Inputs**

- Name (`name`, text, required): The supplier's name.
- Tax ID (`tax_id`, text): The supplier's tax ID.
- VAT number (`vat`, text): The supplier's VAT number.
- Company registration number (`registration_number`, text): The supplier's company registration number.
- Country code (`country_code`, text): The supplier's country, as a two-letter code such as GB or DE.
- Address (`address`, text): The supplier's address.
- Contact name (`contact_name`, text): The person to contact at the supplier.
- Contact email (`contact_email`, text): The supplier's contact email address.
- Contact phone (`contact_phone`, text): The supplier's contact phone number.
- External ID (`external_id`, text): The supplier's ID in your accounting or ERP system.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "address": "example",
    "contactEmail": "example",
    "contactName": "example",
    "contactPhone": "example",
    "countryCode": "example",
    "externalId": "example",
    "externalSource": "example",
    "id": "example",
    "name": "example",
    "status": "example",
    "taxId": "example",
    "uic": "example",
    "vat": "example"
  }
}
```

### Delete custom field value

Delete a value from a custom field.

**Inputs**

- Custom field (`custom_field_id`, text, required): The custom field.
- Value ID (`value_id`, text, required): The value's ID, from List custom field values or Create custom field value.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {}
}
```

### Delete expense

Delete an unpaid bill, reimbursable or cash expense.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {}
}
```

### Freeze or unfreeze card

Freeze a card, unfreeze it, or close it for good. A closed card can't be used again.

**Inputs**

- Card (`card_id`, text, required): The card.
- Set card to (`status`, text, required): What to do with the card. One of: `blocked` (Frozen), `active`, `closed` (Closed (can't be undone)).

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {}
}
```

### Get bank statement

Get a fund account's statement lines (money in and out), newest first, optionally between two times.

**Inputs**

- Fund account (`fund_account_id`, text, required): The Payhawk balance or bank account.
- From (`from`, date and time): Only lines on or after this time.
- To (`to`, date and time): Only lines on or before this time.
- Records to skip (`skip`, number): How many records to skip, to read the next page. Leave empty to start at the first. At least 0.
- Records to return (`take`, number): How many records to return. Leave empty for 100. From 1 to 1000.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "lines": [
      {
        "amount": 1,
        "currency": "example",
        "date": "example",
        "description": "example",
        "expenseIds": [
          "example"
        ],
        "fundAccountId": "example",
        "id": "example",
        "paidAmount": 1,
        "paidCurrency": "example",
        "paymentId": "example",
        "type": "example"
      }
    ],
    "total": 1
  }
}
```

### Get expense

Get an expense with its amounts, category, supplier, document details and approval status.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "approvalProcess": {
      "status": "example",
      "submittedAt": "example"
    },
    "category": {
      "fullName": "example",
      "id": "example",
      "name": "example"
    },
    "createdAt": "example",
    "createdBy": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "document": {
      "documentDate": "example",
      "documentNumber": "example",
      "documentType": "example"
    },
    "id": "example",
    "isPaid": true,
    "modifiedAt": "example",
    "note": "example",
    "owner": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "reconciliation": {
      "baseCurrency": "example",
      "baseTotalAmount": 1,
      "currency": "example",
      "taxAmount": 1,
      "totalAmount": 1
    },
    "reviewedAt": "example",
    "settledAt": "example",
    "status": "example",
    "supplier": {
      "id": "example",
      "name": "example"
    },
    "title": "example",
    "type": "example"
  }
}
```

### Invite user

Invite someone to the Payhawk account. Payhawk emails them an invitation.

**Inputs**

- Email (`email`, text, required): Their email address.
- Role (`role`, text): Their role in Payhawk. Leave empty for employee. Default: `employee`.
- First name (`first_name`, text): Their first name.
- Last name (`last_name`, text): Their last name.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {}
}
```

### List cards

List the account's cards with their status, limit and spending, optionally one user's or by status.

**Inputs**

- Cardholder (`cardholder_id`, text): Only this user's cards.
- Status (`status`, text): Only cards with this status. One of: `active`, `inactive` (Not activated), `processing`, `blocked_by_user` (Frozen by the cardholder), `blocked_by_admin` (Frozen by an admin), `closed` (Closed (can't be undone)), `closed_by_payhawk` (Closed by Payhawk).
- Records to skip (`skip`, number): How many records to skip, to read the next page. Leave empty to start at the first. At least 0.
- Records to return (`take`, number): How many records to return. Leave empty for 100. From 1 to 1000.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "approvedFunds": 1,
        "budgetLeft": 1,
        "createdAt": "example",
        "currency": "example",
        "embossName": "example",
        "fundAccountId": "example",
        "id": "example",
        "isAtmAllowed": true,
        "isPhysical": true,
        "isSingleUse": true,
        "lastDigits": "example",
        "limit": 1,
        "name": "example",
        "spendPolicyId": "example",
        "spentAmount": 1,
        "status": "example",
        "userId": "example"
      }
    ],
    "total": 1
  }
}
```

### List custom field values

List the values people can choose for a custom field.

**Inputs**

- Custom field (`custom_field_id`, text, required): The custom field.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "externalId": "example",
        "id": "example",
        "label": "example",
        "parentId": "example"
      }
    ],
    "total": 1
  }
}
```

### List custom fields

List the account's custom fields, such as cost centers or projects, with their type.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "description": "example",
        "externalId": "example",
        "externalSource": "example",
        "id": "example",
        "isRequired": true,
        "label": "example",
        "type": "example"
      }
    ],
    "total": 1
  }
}
```

### List expense categories

List the account's expense categories with their account codes.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "accountCode": "example",
        "createdAt": "example",
        "fullName": "example",
        "id": "example",
        "name": "example",
        "parentId": "example"
      }
    ],
    "total": 1
  }
}
```

### List expense payments

List the card or bank payments made for an expense, with fees and exchange rates.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "amount": 1,
        "cardId": "example",
        "cardLastDigits": "example",
        "currency": "example",
        "date": "example",
        "description": "example",
        "expenseIds": [
          "example"
        ],
        "fundAccountId": "example",
        "id": "example",
        "originalAmount": 1,
        "originalCurrency": "example",
        "status": "example",
        "type": "example"
      }
    ],
    "total": 1
  }
}
```

### List expenses

List expenses, newest first, optionally by status, owner, supplier or when they were created, changed, settled or reviewed.

**Inputs**

- Status (`status`, text): Only expenses with this status. One of: `draft`, `ready` (Reviewed), `archived`.
- Created after (`created_after`, date and time): Only expenses created after this time.
- Changed after (`modified_after`, date and time): Only expenses changed after this time.
- Settled after (`settled_after`, date and time): Only expenses whose payment settled after this time.
- Reviewed after (`reviewed_after`, date and time): Only expenses reviewed after this time.
- Owner (`owner_id`, text): Only this user's expenses.
- Supplier name (`supplier_name`, text): Only expenses from the supplier with this exact name.
- Order (`order`, text): Newest or oldest first. Leave empty for newest first. One of: `desc`, `asc`. Default: `desc`.
- Records to skip (`skip`, number): How many records to skip, to read the next page. Leave empty to start at the first. At least 0.
- Records to return (`take`, number): How many records to return. Leave empty for 100. From 1 to 1000.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "approvalProcess": {
          "status": "example",
          "submittedAt": "example"
        },
        "category": {
          "fullName": "example",
          "id": "example",
          "name": "example"
        },
        "createdAt": "example",
        "createdBy": {
          "email": "example",
          "externalId": "example",
          "firstName": "example",
          "id": "example",
          "lastName": "example"
        },
        "document": {
          "documentDate": "example",
          "documentNumber": "example",
          "documentType": "example"
        },
        "id": "example",
        "isPaid": true,
        "modifiedAt": "example",
        "note": "example",
        "owner": {
          "email": "example",
          "externalId": "example",
          "firstName": "example",
          "id": "example",
          "lastName": "example"
        },
        "reconciliation": {
          "baseCurrency": "example",
          "baseTotalAmount": 1,
          "currency": "example",
          "taxAmount": 1,
          "totalAmount": 1
        },
        "reviewedAt": "example",
        "settledAt": "example",
        "status": "example",
        "supplier": {
          "id": "example",
          "name": "example"
        },
        "title": "example",
        "type": "example"
      }
    ],
    "total": 1
  }
}
```

### List fund accounts

List the account's Payhawk balances and linked bank accounts with their available amount.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "balance": {
          "availableAmount": 1,
          "reservedAmount": 1
        },
        "currency": "example",
        "id": "example",
        "status": "example",
        "type": "example"
      }
    ],
    "total": 1
  }
}
```

### List suppliers

List the account's active or archived suppliers with their tax and contact details.

**Inputs**

- Status (`status`, text): Active or archived suppliers. Leave empty for active. One of: `active`, `archived`. Default: `active`.
- Records to skip (`skip`, number): How many records to skip, to read the next page. Leave empty to start at the first. At least 0.
- Records to return (`take`, number): How many records to return. Leave empty for 100. From 1 to 1000.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "address": "example",
        "contactEmail": "example",
        "contactName": "example",
        "contactPhone": "example",
        "countryCode": "example",
        "externalId": "example",
        "externalSource": "example",
        "id": "example",
        "name": "example",
        "status": "example",
        "taxId": "example",
        "uic": "example",
        "vat": "example"
      }
    ],
    "total": 1
  }
}
```

### List users

List the account's users with their role, or find one by email address.

**Inputs**

- Email (`email`, text): Only the user with this email address.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "items": [
      {
        "createdAt": "example",
        "deactivationDate": "example",
        "email": "example",
        "externalId": "example",
        "firstName": "example",
        "id": "example",
        "lastName": "example",
        "phoneNumber": "example",
        "role": "example",
        "startDate": "example"
      }
    ],
    "total": 1
  }
}
```

### Mark bill as paid

Record that a bill was paid by bank transfer outside Payhawk, with the payment date and reference.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.
- Paid on (`date`, date and time, required): When it was paid.
- Payment reference (`payment_reference`, text): The bank transfer's reference.
- Paid from (`account_number`, text): The account it was paid from: an account number, IBAN or the bank account's name.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {}
}
```

### Remove user

Remove a user from the Payhawk account.

**Inputs**

- User (`member_id`, text, required): The user.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {}
}
```

### Review expense

Mark an expense as reviewed, or send it back to draft for another look.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.
- Set to (`status`, text, required): Reviewed, or back to draft. One of: `ready` (Reviewed), `draft`.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "approvalProcess": {
      "status": "example",
      "submittedAt": "example"
    },
    "category": {
      "fullName": "example",
      "id": "example",
      "name": "example"
    },
    "createdAt": "example",
    "createdBy": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "document": {
      "documentDate": "example",
      "documentNumber": "example",
      "documentType": "example"
    },
    "id": "example",
    "isPaid": true,
    "modifiedAt": "example",
    "note": "example",
    "owner": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "reconciliation": {
      "baseCurrency": "example",
      "baseTotalAmount": 1,
      "currency": "example",
      "taxAmount": 1,
      "totalAmount": 1
    },
    "reviewedAt": "example",
    "settledAt": "example",
    "status": "example",
    "supplier": {
      "id": "example",
      "name": "example"
    },
    "title": "example",
    "type": "example"
  }
}
```

### Submit expense

Submit an expense for approval, checking the account's required fields.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "approvalProcess": {
      "status": "example",
      "submittedAt": "example"
    },
    "category": {
      "fullName": "example",
      "id": "example",
      "name": "example"
    },
    "createdAt": "example",
    "createdBy": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "document": {
      "documentDate": "example",
      "documentNumber": "example",
      "documentType": "example"
    },
    "id": "example",
    "isPaid": true,
    "modifiedAt": "example",
    "note": "example",
    "owner": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "reconciliation": {
      "baseCurrency": "example",
      "baseTotalAmount": 1,
      "currency": "example",
      "taxAmount": 1,
      "totalAmount": 1
    },
    "reviewedAt": "example",
    "settledAt": "example",
    "status": "example",
    "supplier": {
      "id": "example",
      "name": "example"
    },
    "title": "example",
    "type": "example"
  }
}
```

### Update expense

Change an expense's note, category, supplier, document number or document date. Only the fields filled in change.

**Inputs**

- Expense ID (`expense_id`, text, required): The expense's ID in Payhawk, from List expenses or an earlier step.
- Note (`note`, text): A note about the expense.
- Category (`category_id`, text): The expense category.
- Supplier (`supplier_id`, text): The supplier.
- Document number (`document_number`, text): The invoice or receipt number.
- Document date (`document_date`, date and time): When the invoice or receipt was issued.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "approvalProcess": {
      "status": "example",
      "submittedAt": "example"
    },
    "category": {
      "fullName": "example",
      "id": "example",
      "name": "example"
    },
    "createdAt": "example",
    "createdBy": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "document": {
      "documentDate": "example",
      "documentNumber": "example",
      "documentType": "example"
    },
    "id": "example",
    "isPaid": true,
    "modifiedAt": "example",
    "note": "example",
    "owner": {
      "email": "example",
      "externalId": "example",
      "firstName": "example",
      "id": "example",
      "lastName": "example"
    },
    "reconciliation": {
      "baseCurrency": "example",
      "baseTotalAmount": 1,
      "currency": "example",
      "taxAmount": 1,
      "totalAmount": 1
    },
    "reviewedAt": "example",
    "settledAt": "example",
    "status": "example",
    "supplier": {
      "id": "example",
      "name": "example"
    },
    "title": "example",
    "type": "example"
  }
}
```

### Update supplier

Change a supplier's details. Only the fields filled in change.

**Inputs**

- Supplier (`supplier_id`, text, required): The supplier.
- Name (`name`, text): The supplier's name.
- Tax ID (`tax_id`, text): The supplier's tax ID.
- VAT number (`vat`, text): The supplier's VAT number.
- Company registration number (`registration_number`, text): The supplier's company registration number.
- Country code (`country_code`, text): The supplier's country, as a two-letter code such as GB or DE.
- Address (`address`, text): The supplier's address.
- Contact name (`contact_name`, text): The person to contact at the supplier.
- Contact email (`contact_email`, text): The supplier's contact email address.
- Contact phone (`contact_phone`, text): The supplier's contact phone number.
- External ID (`external_id`, text): The supplier's ID in your accounting or ERP system.

**Outputs**

- `data` (object): The response from Payhawk.

**Example output**

```json
{
  "data": {
    "address": "example",
    "contactEmail": "example",
    "contactName": "example",
    "contactPhone": "example",
    "countryCode": "example",
    "externalId": "example",
    "externalSource": "example",
    "id": "example",
    "name": "example",
    "status": "example",
    "taxId": "example",
    "uic": "example",
    "vat": "example"
  }
}
```
