Seller Ledger API
Welcome to the Seller Ledger API!
We have an official Ruby client with PHP and Python coming soon. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Authentication
# With cURL, you can just pass an Authorization header with your API token as the token
curl "https://api.sellerledger.com/any/route" \
-H "Authorization: token your_api_token"
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
Make sure to replace
your_api_token
with your API key.
Seller Ledger uses API keys to allow access to the API. You can register a new Seller Ledger API key in your business settings.
Seller Ledger expects the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: token your_api_token
Accounts
Get all accounts
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_accounts
curl "https://api.sellerledger.com/v1/accounts" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"accounts": [
{
"id": "22d2d201-4134-430d-8e39-f8fec35845e4",
"name": "Credit Card",
"type": "Expense",
"balance_sheet": false,
"balance": "904.85",
"deposits": "904.85",
"withdrawals": 0
},
{
"id": "bca4769a-e7fd-4b47-ab68-412180150fca",
"name": "Credit Card",
"type": "Income",
"balance_sheet": false,
"balance": "0.0",
"deposits": 0,
"withdrawals": 0
},
{
"id": "02967cdb-4040-4d18-8843-e94d9557b936",
"name": "Credit Card",
"type": "Liability",
"balance_sheet": true,
"balance": "0.0",
"deposits": "4834.57",
"withdrawals": "4834.57"
},
...
]
}
This endpoint retrieves a paginated list of accounts
HTTP Request
GET https://api.sellerledger.com/v1/accounts
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
types | No | Array | [] | Filter types of accounts to return. Can include 'asset', 'liability', 'equity', 'income', 'expense', or 'inventory'. |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of categories to return per page |
Get an account
curl "https://api.sellerledger.com/v1/accounts/02967cdb-4040-4d18-8843-e94d9557b936" \
-H "Authorization: token your_api_token"
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.get_account('02967cdb-4040-4d18-8843-e94d9557b936')
The above command returns JSON structured like this:
{
"account": {
"id": "02967cdb-4040-4d18-8843-e94d9557b936",
"name": "Credit Card",
"type": "Liability",
"balance_sheet": true,
"balance": "0.0",
"deposits": "4834.57",
"withdrawals": "4834.57"
}
}
This endpoint retrieves an account.
HTTP Request
GET https://api.sellerledger.com/v1/accounts/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the account to return |
Get all account entries
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_account_entries("02967cdb-4040-4d18-8843-e94d9557b936")
curl "https://api.sellerledger.com/v1/accounts/02967cdb-4040-4d18-8843-e94d9557b936/entries" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"entries": [
{
"transaction_id": "74414cdb-e433-40dc-bd7d-fe66954fc62a",
"transaction_date": "2024-06-20T20:06:17.196Z",
"transacted_with": "eBay",
"description": "Anthropology Maxi Dress Size M New Halter Top Black Long Sleeveless",
"amount": "5.96",
"signed_amount": "-5.96",
"type": "debit",
"currency_code": "USD",
"account_id": "ce2d3bd2-ea6d-4d5b-8b8d-721e9d6cd1df",
"account_name": "My eBay Store",
"category": {
"id": "33ce993c-5411-476c-be9b-46261b361a82",
"name": "Commissions and fees",
"type": "Expense"
}
},
{
"transaction_id": "9b5ec2e7-f665-4d67-85d8-cfdf29c9f450",
"transaction_date": "2024-06-19T20:06:17.234Z",
"transacted_with": "eBay",
"description": "J. Crew Eyelet Midi Skirt Cotton Blue L New",
"amount": "6.29",
"signed_amount": "-6.29",
"type": "debit",
"currency_code": "USD",
"account_id": "ce2d3bd2-ea6d-4d5b-8b8d-721e9d6cd1df",
"account_name": "My eBay Store",
"category": {
"id": "33ce993c-5411-476c-be9b-46261b361a82",
"name": "Commissions and fees",
"type": "Expense"
}
},
]
}
This endpoint retrieves a paginated list of account journal entries.
HTTP Request
GET https://api.sellerledger.com/v1/accounts/<ID>/entries
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The account ID |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of categories to return per page |
Get all account transactions
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_account_transactions("02967cdb-4040-4d18-8843-e94d9557b936")
curl "https://api.sellerledger.com/v1/accounts/02967cdb-4040-4d18-8843-e94d9557b936/transactions" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"transactions": [
{
"transaction_type": "financial",
"transaction_id": "3fc80325-5326-4abf-90e9-1443962cceb4",
"transaction_date": "2024-06-21T20:07:49.259Z",
"transacted_with": "Shopify",
"description": "Q2 Sales Tax payment",
"amount": "-9.18",
"currency_code": "USD",
"category": {
"id": "fa053ccc-737b-4508-acbe-ac1da99d1681",
"name": "Product sales",
"type": "Income"
}
},
{
"transaction_type": "financial",
"transaction_id": "20ebd8b5-38b2-4041-b8a9-27dafa9a2b23",
"transaction_date": "2024-06-21T20:07:49.224Z",
"transacted_with": "Awesome Credit Card",
"description": "Credit Card payment",
"amount": "-207.84",
"currency_code": "USD",
"category": {
"id": "bbcc88fa-9f50-48e3-bf1d-7da98971c608",
"name": "Transfer: Credit Card",
"type": "Liability"
}
}
]
}
This endpoint retrieves a paginated list of balance sheet account transactions.
Note: the account ID passed into this endpoint must be for a balance sheet account.
HTTP Request
GET https://api.sellerledger.com/v1/accounts/<ID>/transactions
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The account ID |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of categories to return per page |
Business
Get business details
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.get_business
curl "https://api.sellerledger.com/v1/business" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"business": [
{
"name": "My Toy Trucks",
"billing_status": "paid",
"data_syncable_start_date": "2023-01-01T00:00:00.000Z"
}
]
}
This endpoint retrieves data about the business, including the earliest transaction date that will be accepted.
HTTP Request
GET https://api.sellerledger.com/v1/business
Query Parameters
Does not accept any parameters.
Categories
Get all Categories
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_categories
curl "https://api.sellerledger.com/v1/categories" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"categories": [
{
"id": "f53433dd-7095-4663-a5d0-606d2d1fab80",
"name": "Advertising",
"type": "Expense"
},
{
"id":"9fe727ac-c70c-441a-8fd5-f747cda42cf5",
"name":"Car or truck",
"type":"Expense"
},
{
"id":"feab65a2-71e0-4566-9690-50602b234c0e",
"name":"Other Income",
"type":"Income"
},
...
]
}
This endpoint retrieves a paginated list of categories
HTTP Request
GET https://api.sellerledger.com/v1/categories
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
types | No | Array | [] | Filter types of categories to return. Can include 'expense', 'income', 'asset' etc. |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of categories to return per page |
Connections
Get all connections
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_connections
curl "https://api.sellerledger.com/v1/connections" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"connections": [
{
"id": "db2fcb3d-57c9-4358-ae35-6b4a2719e0fb",
"name": "Credit Card",
"balance_sheet_account_type": "liability"
},
...
]
}
This endpoint retrieves a paginated list of connections
HTTP Request
GET https://api.sellerledger.com/v1/connections
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of connections to return per page |
Get a connection
curl "https://api.sellerledger.com/v1/connections/4caeaacd-af05-46c6-9078-8ac83000e3b5" \
-H "Authorization: token your_api_token"
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.get_connection('4caeaacd-af05-46c6-9078-8ac83000e3b5')
The above command returns JSON structured like this:
{
"connection": {
"id": "4caeaacd-af05-46c6-9078-8ac83000e3b5",
"name": "Test",
"balance_sheet_account_type": "asset"
}
}
This endpoint retrieves a connection.
HTTP Request
GET https://api.sellerledger.com/v1/connections/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the connection to return |
Create a connection
require 'seller_ledger'
params = {
name: "My Connection",
balance_sheet_account_type: "asset"
}
client = SellerLedger.new('your_api_token')
client.create_connection(params)
curl "https://api.sellerledger.com/v1/connections" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"name": "My Connection", "balance_sheet_account_type": "asset"}'
The above command returns JSON structured like this:
{
"connection": {
"id": "4caeaacd-af05-46c6-9078-8ac83000e3b5",
"name": "Test",
"balance_sheet_account_type": "asset"
}
}
This endpoint is used to create connections
HTTP Request
POST https://api.sellerledger.com/v1/connections
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
name | Yes | String | Name of connection |
balance_sheet_account_type | Yes | String | The balance sheet account type to use for this connection. Can be 'asset' or 'liability'. Use 'liability' for credit card connections and 'asset' for everything else (e-commerce, bank accounts, etc). |
Delete a connection
curl "https://api.sellerledger.com/v1/connections/4caeaacd-af05-46c6-9078-8ac83000e3b5" \
-H "Authorization: token your_api_token" \
-X DELETE
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.delete_connection('4caeaacd-af05-46c6-9078-8ac83000e3b5')
The above command returns JSON structured like this:
{
"connection": {
"id": "4caeaacd-af05-46c6-9078-8ac83000e3b5",
"name": "Test",
"balance_sheet_account_type": "asset",
}
}
This endpoint deletes a specific connection.
HTTP Request
DELETE https://api.sellerledger.com/v1/connections/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the connection to delete |
Orders
Get all orders
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
connection_id = "db2fcb3d-57c9-4358-ae35-6b4a2719e0fb"
paginated_reponse = client.list_orders(connection_id)
curl "https://api.sellerledger.com/v1/connection/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/orders" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"transactions": [
{
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Hand painted tennis shoes Women's size 6 starry night",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": "123 some street",
"ship_to_address2": null,
"total_amount": "33.85",
"items_subtotal": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "2.36",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "Hand painted tennis shoes Women's size 6 starry night",
"sku": "Y010-AB-BIN402-SHO-FLF",
"quantity": "1.0",
"total_amount": "31.49",
"item_amount": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
},
{
"transaction_id": "1d8d02aa-3464-4ef2-8624-a4d5d2ded2ec",
"transaction_date": "2024-05-30T05:12:51.043Z",
"description": "Hand painted tennis shoes Women's size 9 starry night",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": "123 some street",
"ship_to_address2": null,
"total_amount": "33.85",
"items_subtotal": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "2.36",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "Hand painted tennis shoes Women's size 9 starry night",
"sku": "Y009-AB-BIN402-SHO-FLF",
"quantity": "1.0",
"total_amount": "31.49",
"item_amount": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
},
...
]
}
This endpoint retrieves a paginated list of all of a connection's orders.
HTTP Request
GET https://api.sellerledger.com/v1/connections/<ID>/orders
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the connection |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of orders to return per page |
Get an order
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
connection_id = "db2fcb3d-57c9-4358-ae35-6b4a2719e0fb"
client.get_order(connection_id, '1f7f2a5dac3403930778751f82809b999958bd18')
curl "https://api.sellerledger.com/v1/connection/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/order/1f7f2a5dac3403930778751f82809b999958bd18" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Hand painted tennis shoes Women's size 6 starry night",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": "123 some street",
"ship_to_address2": null,
"total_amount": "33.85",
"items_subtotal": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "2.36",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "Hand painted tennis shoes Women's size 6 starry night",
"sku": "Y010-AB-BIN402-SHO-FLF",
"quantity": "1.0",
"total_amount": "31.49",
"item_amount": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint retrieves a specific order.
HTTP Request
GET https://api.sellerledger.com/v1/connections/<CID>/order/<ID>
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
CID | Yes | String | n/a | The ID of the connection |
ID | Yes | String | n/a | The ID of the order |
Create an order
require 'seller_ledger'
params = {
transaction_id: "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
transaction_date: "2024-06-17T05:12:50.820Z",
description: "Bob's Big Burger",
currency_code: "USD",
ship_to_country_code: "US",
ship_to_state: "CA",
ship_to_city: "Oceanside",
ship_to_zip: "91910",
total_amount: 132.12,
items_subtotal: 122.12,
shipping_amount: 10.00,
items: [
{
product_name: "A Very Nice (And Somehow Shipped) Burger",
quantity: 2,
total_amount: 132.12,
item_amount: 122.12
shipping_amount: 10
}
]
}
client = SellerLedger.new('your_api_token')
client.create_order(connection_id, params)
curl "https://api.sellerledger.com/v1/connections/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/orders" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"transaction_id":"085c2f2d-6ef8-44f6-84d3-07431c2e6c41","transaction_date":"2024-06-17T05:12:50.820Z","description":"Bob's Big Burger","currency_code":"USD","ship_to_country_code":"US","ship_to_state":"CA","ship_to_city":"Oceanside","total_amount":132.12,"items_subtotal":132.12,"shipping_amount":10.0,"items":[{"product_name":"A Very Nice (And Somehow Shipped) Burger","quantity":2,"total_amount":132.12,"item_total": 122.12,"shipping_amount":10}]}'
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Bob's Big Burger",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": null,
"ship_to_address2": null,
"total_amount": "132.12",
"items_subtotal": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "0.0",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "A Very Nice (And Somehow Shipped) Burger",
"sku": null,
"quantity": "2.0",
"total_amount": "132.12",
"item_amount": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint is used to create orders.
HTTP Request
POST https://api.sellerledger.com/v1/connections/<ID>/orders
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
ID | Yes | String | The connection ID |
transaction_id | No | String | A transaction ID, unique per connection. If transaction_id is not provided a unique UUID will be assigned. |
transaction_date | Yes | DateTime | The date and time the transaction occurred |
description | No | String | A description of the transaction. If description is not provided the first item's name will be used if it is available. |
currency_code | Yes | String | The code of the currency used |
ship_to_country_code | Yes | String | The ISO code of the country where the transaction occurred |
ship_to_state | Yes | String | The state/province where the transaction occurred |
ship_to_zip | Yes | String | The zip/postal code where the transaction occurred |
ship_to_address1 | No | String | The address where the transaction occurred |
ship_to_address2 | No | String | The address where the transaction occurred |
total_amount | Yes | Float | The final amount of the transaction |
items_subtotal | Yes | Float | The goods amount (total less shipping, discount, handling, tax, and fees |
shipping_amount | No | Float | The shipping amount of the transaction |
handling_amount | No | Float | The handling amount of the transaction |
fees_amount | No | Float | The fees amount included in the total_amount (paid by the seller) of the transaction. |
tax_amount | No | Float | The sales tax amount of the transaction |
marketplace_remitted_tax | No | Boolean | If the tax amount was remitted by a marketplace |
items | No | Array | The items attached to the transaction |
items[]product_name | Yes | String | The name of the product sold |
items[]sku | No | String | SKU identifier for the product sold |
items[]quantity | Yes | Integer | Quantity of items sold |
items[]total_amount | Yes | Float | total amount of the item (item_amount + tax_amount + handling_amount + shipping_amount - discount_amount) |
items[]item_amount | Yes | Float | The total of the item sold (item price * quantity) |
items[]shipping_amount | No | Float | Shipping amount for this item |
items[]discount_amount | No | Float | Discount amount for this item |
items[]tax_amount | No | Float | Tax amount for this item |
items[]handling_amount | No | Float | Handling amount for this item |
When an order has items the sum of item values must equal the order level value. For example, when pushing in an order with items if an item has a discount amount that amount must be included in the order level discount amount.
Update an order
require 'seller_ledger'
params = {
transaction_date: "2024-06-17T05:12:50.820Z",
description: "Bob's Big Burger Update",
currency_code: "USD",
ship_to_country_code: "US",
ship_to_state: "CA",
ship_to_city: "Oceanside",
ship_to_zip: "91910",
total_amount: 132.12,
items_subtotal: 122.12,
shipping_amount: 10.00,
items: [
{
product_name: "A Very Nice (And Somehow Shipped) Burger",
quantity: 2,
total_amount: 132.12,
item_amount: 122.12
shipping_amount: 10
}
]
}
client = SellerLedger.new('your_api_token')
client.update_order(connection_id, params[:transaction_id], params)
curl "https://api.sellerledger.com/v1/connections/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/order/085c2f2d-6ef8-44f6-84d3-07431c2e6c41" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"transaction_date":"2024-06-17T05:12:50.820Z","description":"Bob's Big Burger","currency_code":"USD","ship_to_country_code":"US","ship_to_state":"CA","ship_to_city":"Oceanside","total_amount":132.12,"items_subtotal":122.12,"shipping_amount":10.0,"items":[{"product_name":"A Very Nice (And Somehow Shipped) Burger","quantity":2,"total_amount":132.12,"item_amount":122.12,"shipping_amount":10}]}'
-X PUT
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Bob's Big Burger",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": null,
"ship_to_address2": null,
"total_amount": "132.12",
"items_subtotal": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "0.0",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "A Very Nice (And Somehow Shipped) Burger",
"sku": null,
"quantity": "2.0",
"total_amount": "132.12",
"item_amount": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint is used to update orders.
HTTP Request
POST https://api.sellerledger.com/v1/connections/<CID>/orders/<ID>
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
CID | Yes | String | The connection ID |
ID | Yes | String | A transaction ID, unique per connection |
transaction_date | Yes | DateTime | The date and time the transaction occurred |
description | No | String | A description of the transaction. If description is not provided the first item's name will be used if it is available. |
currency_code | Yes | String | The code of the currency used |
ship_to_country_code | Yes | String | The ISO code of the country where the transaction occurred |
ship_to_state | Yes | String | The state/province where the transaction occurred |
ship_to_zip | Yes | String | The zip/postal code where the transaction occurred |
ship_to_address1 | No | String | The address where the transaction occurred |
ship_to_address2 | No | String | The address where the transaction occurred |
total_amount | Yes | Float | The final amount of the transaction |
items_subtotal | Yes | Float | The goods amount (total less shipping, discount, handling, tax, and fees |
shipping_amount | No | Float | The shipping amount of the transaction |
handling_amount | No | Float | The handling amount of the transaction |
fees_amount | No | Float | The fees amount included in the total_amount (paid by the seller) of the transaction. |
tax_amount | No | Float | The sales tax amount of the transaction |
marketplace_remitted_tax | No | Boolean | If the tax amount was remitted by a marketplace |
items | No | Array | The items attached to the transaction |
items[]product_name | Yes | String | The name of the product sold |
items[]sku | No | String | SKU identifier for the product sold |
items[]quantity | Yes | Integer | Quantity of items sold |
items[]total_amount | Yes | Float | total amount of the item (item_amount + tax_amount + handling_amount + shipping_amount - discount_amount) |
items[]item_amount | Yes | Float | The total of the item sold (item price * quantity) |
items[]shipping_amount | No | Float | Shipping amount for this item |
items[]discount_amount | No | Float | Discount amount for this item |
items[]tax_amount | No | Float | Tax amount for this item |
items[]handling_amount | No | Float | Handling amount for this item |
When an order has items the sum of item values must equal the order level value. For example, when pushing in an order with items if an item has a discount amount that amount must be included in the order level discount amount.
Delete a order
curl "https://api.sellerledger.com/v1/connections/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/order/085c2f2d-6ef8-44f6-84d3-07431c2e6c41" \
-H "Authorization: token your_api_token" \
-X DELETE
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.delete_order(connection_id, '085c2f2d-6ef8-44f6-84d3-07431c2e6c41')
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Bob's Big Burger",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": null,
"ship_to_address2": null,
"total_amount": "132.12",
"items_subtotal": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "0.0",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "A Very Nice (And Somehow Shipped) Burger",
"sku": null,
"quantity": "2.0",
"total_amount": "132.12",
"item_amount": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint deletes a specific order.
HTTP Request
DELETE https://api.sellerledger.com/v1/connections/<CID>/orders/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
CID | Yes | String | n/a | The ID of the connection |
ID | Yes | String | n/a | The ID of the order to delete |
Refunds
Get all refunds
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
connection_id = "db2fcb3d-57c9-4358-ae35-6b4a2719e0fb"
paginated_reponse = client.list_refunds(connection_id)
curl "https://api.sellerledger.com/v1/connection/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/refunds" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"transactions": [
{
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Hand painted tennis shoes Women's size 6 starry night",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": "123 some street",
"ship_to_address2": null,
"total_amount": "33.85",
"items_subtotal": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "2.36",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "Hand painted tennis shoes Women's size 6 starry night",
"sku": "Y010-AB-BIN402-SHO-FLF",
"quantity": "1.0",
"total_amount": "31.49",
"item_amount": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
},
{
"transaction_id": "1d8d02aa-3464-4ef2-8624-a4d5d2ded2ec",
"transaction_date": "2024-05-30T05:12:51.043Z",
"description": "Hand painted tennis shoes Women's size 9 starry night",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": "123 some street",
"ship_to_address2": null,
"total_amount": "33.85",
"items_subtotal": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "2.36",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "Hand painted tennis shoes Women's size 9 starry night",
"sku": "Y009-AB-BIN402-SHO-FLF",
"quantity": "1.0",
"total_amount": "31.49",
"item_amount": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
},
...
]
}
This endpoint retrieves a paginated list of all of a connection's refunds.
HTTP Request
GET https://api.sellerledger.com/v1/connections/<ID>/refunds
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the connection |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of refunds to return per page |
Get a refund
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
connection_id = "db2fcb3d-57c9-4358-ae35-6b4a2719e0fb"
paginated_reponse = client.get_refund(connection_id, '1f7f2a5dac3403930778751f82809b999958bd18')
curl "https://api.sellerledger.com/v1/connection/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/refund/1f7f2a5dac3403930778751f82809b999958bd18" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Hand painted tennis shoes Women's size 6 starry night",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": "123 some street",
"ship_to_address2": null,
"total_amount": "33.85",
"items_subtotal": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "2.36",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "Hand painted tennis shoes Women's size 6 starry night",
"sku": "Y010-AB-BIN402-SHO-FLF",
"quantity": "1.0",
"total_amount": "31.49",
"item_amount": "24.99",
"shipping_amount": "6.5",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint retrieves a specific refund.
HTTP Request
GET https://api.sellerledger.com/v1/connections/<CID>/refund/<ID>
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
CID | Yes | String | n/a | The ID of the connection |
ID | Yes | String | n/a | The ID of the refund |
Create a refund
require 'seller_ledger'
params = {
transaction_id: "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
transaction_date: "2024-06-17T05:12:50.820Z",
description: "Bob's Big Burger",
currency_code: "USD",
ship_to_country_code: "US",
ship_to_state: "CA",
ship_to_city: "Oceanside",
ship_to_zip: "91910",
total_amount: 132.12,
items_subtotal: 122.12,
shipping_amount: 10.00,
items: [
{
product_name: "A Very Nice (And Somehow Shipped) Burger",
quantity: 2,
total_amount: 132.12,
item_amount: 122.12
shipping_amount: 10
}
]
}
client = SellerLedger.new('your_api_token')
client.create_refund(connection_id, params)
curl "https://api.sellerledger.com/v1/connections/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/refunds" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"transaction_id":"085c2f2d-6ef8-44f6-84d3-07431c2e6c41","transaction_date":"2024-06-17T05:12:50.820Z","description":"Bob's Big Burger","currency_code":"USD","ship_to_country_code":"US","ship_to_state":"CA","ship_to_city":"Oceanside","total_amount":132.12,"items_subtotal":122.12,"shipping_amount":10.0,"items":[{"product_name":"A Very Nice (And Somehow Shipped) Burger","quantity":2,"item_amount":122.12,"total_amount":132.12,"shipping_amount":10}]}'
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Bob's Big Burger",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": null,
"ship_to_address2": null,
"total_amount": "132.12",
"items_subtotal": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "0.0",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "A Very Nice (And Somehow Shipped) Burger",
"sku": null,
"quantity": "2.0",
"total_amount": "132.12",
"item_amount": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint is used to create refunds.
HTTP Request
POST https://api.sellerledger.com/v1/connections/<ID>/refunds
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
ID | Yes | String | The connection ID |
transaction_id | No | String | A transaction ID, unique per connection. If transaction_id is not provided a unique UUID will be assigned. |
transaction_date | Yes | DateTime | The date and time the transaction occurred |
description | No | String | A description of the transaction. If description is not provided the first item's name will be used if it is available. |
currency_code | Yes | String | The code of the currency used |
ship_to_country_code | Yes | String | The ISO code of the country where the transaction occurred |
ship_to_state | Yes | String | The state/province where the transaction occurred |
ship_to_zip | Yes | String | The zip/postal code where the transaction occurred |
ship_to_address1 | No | String | The address where the transaction occurred |
ship_to_address2 | No | String | The address where the transaction occurred |
total_amount | Yes | Float | The final amount of the transaction |
items_subtotal | Yes | Float | The goods amount (total less shipping, discount, handling, tax, and fees |
shipping_amount | No | Float | The shipping amount of the transaction |
handling_amount | No | Float | The handling amount of the transaction |
fees_amount | No | Float | The fees amount included in the total_amount (paid by the seller) of the transaction. |
tax_amount | No | Float | The sales tax amount of the transaction |
marketplace_remitted_tax | No | Boolean | If the tax amount was remitted by a marketplace |
items | No | Array | The items attached to the transaction |
items[]product_name | Yes | String | The name of the product sold |
items[]sku | No | String | SKU identifier for the product sold |
items[]quantity | Yes | Integer | Quantity of items sold |
items[]total_amount | Yes | Float | total amount of the item (item_amount + tax_amount + handling_amount + shipping_amount - discount_amount) |
items[]item_amount | Yes | Float | The total of the item sold (item price * quantity) |
items[]shipping_amount | No | Float | Shipping amount for this item |
items[]discount_amount | No | Float | Discount amount for this item |
items[]tax_amount | No | Float | Tax amount for this item |
items[]handling_amount | No | Float | Handling amount for this item |
When an order has items the sum of item values must equal the order level value. For example, when pushing in an order with items if an item has a discount amount that amount must be included in the order level discount amount.
Update a refund
require 'seller_ledger'
params = {
transaction_date: "2024-06-17T05:12:50.820Z",
description: "Bob's Big Burger Update",
currency_code: "USD",
ship_to_country_code: "US",
ship_to_state: "CA",
ship_to_city: "Oceanside",
ship_to_zip: "91910",
total_amount: 132.12,
items_subtotal: 122.12,
shipping_amount: 10.00,
items: [
{
product_name: "A Very Nice (And Somehow Shipped) Burger",
quantity: 2,
total_amount: 132.12,
item_amount: 122.12
shipping_amount: 10
}
]
}
client = SellerLedger.new('your_api_token')
client.update_refund(connection_id, params[:transaction_id], params)
curl "https://api.sellerledger.com/v1/connections/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/refund/085c2f2d-6ef8-44f6-84d3-07431c2e6c41" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"transaction_date":"2024-06-17T05:12:50.820Z","description":"Bob's Big Burger","currency_code":"USD","ship_to_country_code":"US","ship_to_state":"CA","ship_to_city":"Oceanside","total_amount":132.12,"items_subtotal":122.12,"shipping_amount":10.0,"items":[{"product_name":"A Very Nice (And Somehow Shipped) Burger","quantity":2,"item_amount":122.12,"total_amount":132.12,"shipping_amount":10}]}'
-X PUT
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Bob's Big Burger",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": null,
"ship_to_address2": null,
"total_amount": "132.12",
"items_subtotal": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "0.0",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "A Very Nice (And Somehow Shipped) Burger",
"sku": null,
"quantity": "2.0",
"total_amount": "132.12",
"item_amount": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint is used to update refunds.
HTTP Request
POST https://api.sellerledger.com/v1/connections/<CID>/refunds/<ID>
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
CID | Yes | String | The connection ID |
ID | Yes | String | A transaction ID, unique per connection |
transaction_date | Yes | DateTime | The date and time the transaction occurred |
description | No | String | A description of the transaction. If description is not provided the first item's name will be used if it is available. |
currency_code | Yes | String | The code of the currency used |
ship_to_country_code | Yes | String | The ISO code of the country where the transaction occurred |
ship_to_state | Yes | String | The state/province where the transaction occurred |
ship_to_zip | Yes | String | The zip/postal code where the transaction occurred |
ship_to_address1 | No | String | The address where the transaction occurred |
ship_to_address2 | No | String | The address where the transaction occurred |
total_amount | Yes | Float | The final amount of the transaction |
items_subtotal | Yes | Float | The goods amount (total less shipping, discount, handling, tax, and fees |
shipping_amount | No | Float | The shipping amount of the transaction |
handling_amount | No | Float | The handling amount of the transaction |
fees_amount | No | Float | The fees amount included in the total_amount (paid by the seller) of the transaction. |
tax_amount | No | Float | The sales tax amount of the transaction |
marketplace_remitted_tax | No | Boolean | If the tax amount was remitted by a marketplace |
items | No | Array | The items attached to the transaction |
items[]product_name | Yes | String | The name of the product sold |
items[]sku | No | String | SKU identifier for the product sold |
items[]quantity | Yes | Integer | Quantity of items sold |
items[]total_amount | Yes | Float | total amount of the item (item_amount + tax_amount + handling_amount + shipping_amount - discount_amount) |
items[]item_amount | Yes | Float | The total of the item sold (item price * quantity) |
items[]shipping_amount | No | Float | Shipping amount for this item |
items[]discount_amount | No | Float | Discount amount for this item |
items[]tax_amount | No | Float | Tax amount for this item |
items[]handling_amount | No | Float | Handling amount for this item |
When an order has items the sum of item values must equal the order level value. For example, when pushing in an order with items if an item has a discount amount that amount must be included in the order level discount amount.
Delete a refund
curl "https://api.sellerledger.com/v1/connections/db2fcb3d-57c9-4358-ae35-6b4a2719e0fb/refund/085c2f2d-6ef8-44f6-84d3-07431c2e6c41" \
-H "Authorization: token your_api_token" \
-X DELETE
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.delete_refund(connection_id, '085c2f2d-6ef8-44f6-84d3-07431c2e6c41')
The above command returns JSON structured like this:
{
"transaction": {
"transaction_id": "085c2f2d-6ef8-44f6-84d3-07431c2e6c41",
"transaction_date": "2024-06-17T05:12:50.820Z",
"description": "Bob's Big Burger",
"currency_code": "USD",
"ship_to_country_code": "US",
"ship_to_state": "CA",
"ship_to_zip": "91910",
"ship_to_city": "Oceanside",
"ship_to_address1": null,
"ship_to_address2": null,
"total_amount": "132.12",
"items_subtotal": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"fees_amount": "0.0",
"tax_amount": "0.0",
"marketplace_remitted_tax": false,
"items": [
{
"product_name": "A Very Nice (And Somehow Shipped) Burger",
"sku": null,
"quantity": "2.0",
"total_amount": "132.12",
"item_amount": "122.12",
"shipping_amount": "10.0",
"discount_amount": "0.0",
"handling_amount": "0.0",
"tax_amount": "0.0"
}
]
}
}
This endpoint deletes a specific refund.
HTTP Request
DELETE https://api.sellerledger.com/v1/connections/<CID>/refunds/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
CID | Yes | String | n/a | The ID of the connection |
ID | Yes | String | n/a | The ID of the refund to delete |
Inventory Purchases
Get all inventory purchases
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_inventory_purchases
curl "https://api.sellerledger.com/v1/inventory/purchases" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"purchases": [
{
"id": "f1c6c387-4ae7-4868-a90c-9e868dab998a",
"name": "Marshalls",
"transaction_date": "2024-05-23T20:07:50.120Z",
"amount": "28.74",
"amount_unallocated_to_items": "28.74",
"items": [],
"transaction": {
"transaction_type": "financial",
"transaction_id": "4fe3eb3c-4d4e-45ed-b040-7007654e477f",
"transaction_date": "2024-05-23T20:07:50.120Z",
"transacted_with": "Marshalls",
"description": "Betsey Johnson Women's Chiffon Printed Cocktail Dress",
"amount": "-28.74",
"currency_code": "USD",
"category": {
"id": "6d527869-7fdd-437e-b99e-abf22ef33b3a",
"name": "Inventory",
"type": "Asset"
}
}
},
{
"id": "71573ae4-7bb1-4774-9776-66ba0c768419",
"name": "Anthropologie",
"transaction_date": "2024-05-20T20:07:50.153Z",
"amount": "39.43",
"amount_unallocated_to_items": "39.43",
"items": [],
"transaction": {
"transaction_type": "financial",
"transaction_id": "a9d4a746-e09c-48d5-83a4-6598f7aec7cf",
"transaction_date": "2024-05-20T20:07:50.153Z",
"transacted_with": "Anthropologie",
"description": "In store purchase",
"amount": "-39.43",
"currency_code": "USD",
"category": {
"id": "6d527869-7fdd-437e-b99e-abf22ef33b3a",
"name": "Inventory",
"type": "Asset"
}
}
},
...
]
}
This endpoint retrieves a paginated list of inventory purchases.
HTTP Request
GET https://api.sellerledger.com/v1/inventory/purchases
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of inventory purchases to return per page |
Get an inventory purchase
curl "https://api.sellerledger.com/v1/inventory/purchases/f1c6c387-4ae7-4868-a90c-9e868dab998a" \
-H "Authorization: token your_api_token"
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.get_inventory_purchase('f1c6c387-4ae7-4868-a90c-9e868dab998a')
The above command returns JSON structured like this:
{
"purchase": {
"id": "f1c6c387-4ae7-4868-a90c-9e868dab998a",
"name": "Marshalls",
"transaction_date": "2024-05-23T20:07:50.120Z",
"amount": "28.74",
"amount_unallocated_to_items": "28.74",
"items": [],
"transaction": {
"transaction_type": "financial",
"transaction_id": "4fe3eb3c-4d4e-45ed-b040-7007654e477f",
"transaction_date": "2024-05-23T20:07:50.120Z",
"transacted_with": "Marshalls",
"description": "Betsey Johnson Women's Chiffon Printed Cocktail Dress",
"amount": "-28.74",
"currency_code": "USD",
"category": {
"id": "6d527869-7fdd-437e-b99e-abf22ef33b3a",
"name": "Inventory",
"type": "Asset"
}
}
}
}
This endpoint retrieves a inventory purchase.
HTTP Request
GET https://api.sellerledger.com/v1/inventory/purchases/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the inventory purchase to return |
Create an inventory purchase
require 'seller_ledger'
params = {
name: "Marshalls",
amount: 28.74,
purchase_date: "2024-05-23T20:07:50.120Z",
items: [
{ quantity: 1, total_amount: 27.74, product: { sku: "hello" } }
]
}
client = SellerLedger.new('your_api_token')
client.create_inventory_purchase(params)
curl "https://api.sellerledger.com/v1/inventory/purchases" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"name": "Marshalls", "amount": 28.74, purchase_date: "2024-05-23T20:07:50.120Z", "items": [{ "quantity": 1, "total_amount": 27.74, "product": {"sku": "hello" }}]}'
The above command returns JSON structured like this:
{
"purchase": {
"id": "f1c6c387-4ae7-4868-a90c-9e868dab998a",
"name": "Marshalls",
"transaction_date": "2024-05-23T20:07:50.120Z",
"amount": "27.74",
"amount_unallocated_to_items": "1.00",
"items": [
{
"id": "f4aea9d4-8889-43fe-a860-03acf4917f28",
"quantity": 1,
"stock": 0.0,
"total_amount": 27.74,
"unit_amount": 27.74,
"product": {
"id": "af4281ff-da97-4d39-bc8c-d5236ad63cb5",
"name": nil,
"sku": "hello"
}
],
"transaction": {
"transaction_type": "financial",
"transaction_id": "4fe3eb3c-4d4e-45ed-b040-7007654e477f",
"transaction_date": "2024-05-23T20:07:50.120Z",
"transacted_with": "Marshalls",
"description": "Betsey Johnson Women's Chiffon Printed Cocktail Dress",
"amount": "-28.74",
"currency_code": "USD",
"category": {
"id": "6d527869-7fdd-437e-b99e-abf22ef33b3a",
"name": "Inventory",
"type": "Asset"
}
}
}
}
This endpoint is used to create inventory purchases
HTTP Request
POST https://api.sellerledger.com/v1/inventory/purchases
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
name | Yes | String | Name of inventory purchase |
amount | Yes | Float | Inventory purchase total amount |
purchase_date | Yes | DateTime | UTC date and time of inventory purchase |
items | No | Array | Items of inventory purchase; only item SKU is required. |
Delete a inventory purchase
curl "https://api.sellerledger.com/v1/inventory/purchases/f1c6c387-4ae7-4868-a90c-9e868dab998a" \
-H "Authorization: token your_api_token" \
-X DELETE
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.delete_inventory_purchase('f1c6c387-4ae7-4868-a90c-9e868dab998a')
The above command returns JSON structured like this:
{
"purchase": {
"id": "f1c6c387-4ae7-4868-a90c-9e868dab998a",
"name": "Marshalls",
"transaction_date": "2024-05-23T20:07:50.120Z",
"amount": "27.74",
"amount_unallocated_to_items": "1.00",
"items": [
{
"id": "f4aea9d4-8889-43fe-a860-03acf4917f28",
"quantity": 1,
"stock": 0.0,
"total_amount": 27.74,
"unit_amount": 27.74,
"product": {
"id": "af4281ff-da97-4d39-bc8c-d5236ad63cb5",
"name": nil,
"sku": "hello"
}
],
"transaction": {
"transaction_type": "financial",
"transaction_id": "4fe3eb3c-4d4e-45ed-b040-7007654e477f",
"transaction_date": "2024-05-23T20:07:50.120Z",
"transacted_with": "Marshalls",
"description": "Betsey Johnson Women's Chiffon Printed Cocktail Dress",
"amount": "-28.74",
"currency_code": "USD",
"category": {
"id": "6d527869-7fdd-437e-b99e-abf22ef33b3a",
"name": "Inventory",
"type": "Asset"
}
}
}
}
This endpoint deletes a specific inventory purchase.
HTTP Request
DELETE https://api.sellerledger.com/v1/inventory/purchases/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the inventory purchase to delete |
Mileage Expenses
Get all mileage expenses
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_mileage_expenses
curl "https://api.sellerledger.com/v1/mileage_expenses" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"mileage_expenses": [
{
"id": "47dfb1e8-fccd-4ac3-8b1b-d306470bb46c",
"trip_date": "2024-04-19",
"distance": "11.4",
"rate": "0.67",
"description": "Trip to GoodWill"
},
{
"id": "63cc343b-8da1-46d3-b9d3-449fb1802246",
"trip_date": "2024-04-18",
"distance": "31.2",
"rate": "0.67",
"description": "State auction"
}
]
}
This endpoint retrieves a paginated list of mileage expenses
HTTP Request
GET https://api.sellerledger.com/v1/mileage_expenses
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of mileage expenses to return per page |
Get a mileage expense
curl "https://api.sellerledger.com/v1/mileage_expenses/63cc343b-8da1-46d3-b9d3-449fb1802246" \
-H "Authorization: token your_api_token"
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.get_mileage_expense('63cc343b-8da1-46d3-b9d3-449fb1802246')
The above command returns JSON structured like this:
{
"expense": {
"id": "63cc343b-8da1-46d3-b9d3-449fb1802246",
"trip_date": "2024-04-17",
"distance": "11.1",
"rate": "0.67",
"expense": "7.44",
"description":"Updated"
}
}
This endpoint retrieves a mileage expense.
HTTP Request
GET https://api.sellerledger.com/v1/mileage_expenses/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the mileage expense to return |
Create a mileage expense
require 'seller_ledger'
params = {
trip_date: Date.new(2024, 4, 17),
description: "Trip to Goodwill",
distance: 11.1
}
client = SellerLedger.new('your_api_token')
client.create_mileage_expense(params)
curl "https://api.sellerledger.com/v1/mileage_expenses" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"trip_date": "2024-04-17", "description": "Trip to Goodwill", "distance": 11.1}'
The above command returns JSON structured like this:
{
"expense": {
"id": "63cc343b-8da1-46d3-b9d3-449fb1802246",
"trip_date": "2024-04-17",
"distance": "11.1",
"rate": "0.67",
"expense": "7.44",
"description":"Trip to Goodwill"
}
}
This endpoint is used to create mileage expenses.
HTTP Request
POST https://api.sellerledger.com/v1/mileage_expenses
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
trip_date | Yes | Stringified Date | Date of trip, YYYY-MM-DD format |
description | Yes | String | Description of trip |
distance | Yes | Float | Distance traveled |
Update a mileage expense
require 'seller_ledger'
params = {
trip_date: Date.new(2024, 4, 18),
description: "Trip to Goodwill and back",
distance: 22.2
}
client = SellerLedger.new('your_api_token')
client.update_mileage_expense("63cc343b-8da1-46d3-b9d3-449fb1802246", params)
curl "https://api.sellerledger.com/v1/mileage_expenses/63cc343b-8da1-46d3-b9d3-449fb1802246" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"trip_date": "2024-04-18", "description": "Trip to Goodwill and back", "distance": 22.2}' \
-X PUT
The above command returns JSON structured like this:
{
"expense": {
"id": "63cc343b-8da1-46d3-b9d3-449fb1802246",
"trip_date": "2024-04-18",
"distance": "22.2",
"rate": "0.67",
"expense": "14.78",
"description":"Trip to Goodwill and back"
}
}
This endpoint updates an existing mileage expense
HTTP Request
PUT https://api.sellerledger.com/v1/mileage_expenses/<ID>
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
Yes | String | The ID of the mileage expense | |
trip_date | Yes | DateTime | Date of trip, YYYY-MM-DD format |
description | Yes | String | Description of trip |
distance | Yes | Float | Distance traveled |
Delete a mileage expense
curl "https://api.sellerledger.com/v1/mileage_expenses/63cc343b-8da1-46d3-b9d3-449fb1802246" \
-H "Authorization: token your_api_token" \
-X DELETE
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.delete_mileage_expense('63cc343b-8da1-46d3-b9d3-449fb1802246')
The above command returns JSON structured like this:
{
"expense": {
"id": "63cc343b-8da1-46d3-b9d3-449fb1802246",
"trip_date": "2024-04-17",
"distance": "11.1",
"rate": "0.67",
"expense": "7.44",
"description":"Updated"
}
}
This endpoint deletes a specific mileage expense.
HTTP Request
DELETE https://api.sellerledger.com/v1/expenses/milage/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the mileage expense to delete |
Transactions
Get all transactions
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
paginated_reponse = client.list_transactions
curl "https://api.sellerledger.com/v1/transactions" \
-H "Authorization: token your_api_token"
The above command returns JSON structured like this:
{
"transactions": [
{
"transaction_type": "order",
"transaction_id": "m40758123359",
"transaction_date": "2024-06-26T00:00:00.000Z",
"transacted_with": "Sally and Bob's",
"description": "Order number 1",
"amount": "26.99",
"currency_code": "USD",
"category": {
"id": "feab65a2-71e0-4566-9690-50602b234c0e",
"name":"Product Sales",
"type":"Income"
}
},
{
"transaction_id": "580e0c2f-c0d2-4a68-bd87-b6b76abcca01",
"transaction_date": "2024-05-03T12:00:00.000Z",
"transacted_with":"Sally and Bob's",
"description": "Order number 2",
"amount":"132.12",
"currency_code":"USD",
"category": {
"id": "feab65a2-71e0-4566-9690-50602b234c0e",
"name":"Product Sales",
"type":"Income"
}
},
...
]
}
This endpoint retrieves a paginated list of all connection transactions of any type.
HTTP Request
GET https://api.sellerledger.com/v1/transactions
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
connection_id | No | String | n/a | Filters transactions by this connection ID |
transaction_type | No | String | n/a | Filters transactions by this type. Can be all , income , expense , or financial |
page | No | Integer | 0 | Page number to return |
per_page | No | Integer | 25 | Number of financial transactions to return per page |
Get a transaction
curl "https://api.sellerledger.com/v1/transactions/580e0c2f-c0d2-4a68-bd87-b6b76abcca01" \
-H "Authorization: token your_api_token"
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.get_transaction('580e0c2f-c0d2-4a68-bd87-b6b76abcca01')
The above command returns JSON structured like this:
{
"transaction": {
"transaction_type": "income",
"transaction_id": "580e0c2f-c0d2-4a68-bd87-b6b76abcca01",
"transaction_date": "2024-05-03T12:00:00.000Z",
"transacted_with": "Sally and Bob's",
"description": "Sold supplies",
"amount": "132.12",
"currency_code": "USD",
"category": {
"id":"feab65a2-71e0-4566-9690-50602b234c0e",
"name": "Other Income",
"type": "Income"
}
}
}
This endpoint retrieves a transaction.
HTTP Request
GET https://api.sellerledger.com/v1/transactions/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the transaction to return |
connection_id | No | String | n/a | Filters the transaction by this connection ID. |
Create a transaction
require 'seller_ledger'
params = {
transaction_date: "2024-05-03 12:00:00",
transacted_with: "Sally and Bob's",
description: "Sold supplies",
currency_code: "USD",
amount: 132.12,
category_id: "feab65a2-71e0-4566-9690-50602b234c0e"
}
client = SellerLedger.new('your_api_token')
client.create_transaction(params)
curl "https://api.sellerledger.com/v1/transactions" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"transaction_date": "2024-05-03 12:00:00", "transacted_with": "Sally and Bob''s", "description": "Sold supplies", "currency_code": "USD", "amount": 132.12, "category_id": "feab65a2-71e0-4566-9690-50602b234c0e"}'
The above command returns JSON structured like this:
{
"transaction": {
"transaction_type": "financial",
"transaction_id": "580e0c2f-c0d2-4a68-bd87-b6b76abcca01",
"transaction_date": "2024-05-03T12:00:00.000Z",
"transacted_with": "Sally and Bob's",
"description": "Sold supplies",
"amount": "132.12",
"currency_code": "USD",
"category": {
"id":"feab65a2-71e0-4566-9690-50602b234c0e",
"name": "Other Income",
"type": "Income"
}
}
}
This endpoint is used to create transactions.
HTTP Request
POST https://api.sellerledger.com/v1/transactions
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
ID | Yes | String | n/a |
connection_id | No | String | A connection ID for this transaction. |
transaction_id | No | String | A unique identifier for this transaction. A UUID will be assigned if no value is given. |
transaction_date | Yes | Date Time | UTC Date time for when this transaction took place |
transacted_with | Yes | String | Merchant or vendor name this transaction happened with |
description | Yes | String | Brief description of the transaction |
currency_code | Yes | String | Abbreviated currency code (USD) |
amount | Yes | Float | Transaction total amount |
category_id | Yes | String | Seller Ledger Category ID for this transaction. See the categories documentation. |
Update a transaction
require 'seller_ledger'
params = {
transaction_date: "2024-05-04 12:00:00",
transacted_with: "Sally and Bob's",
description: "Sold supplies and sundries",
currency_code: "USD",
amount: 151.42,
category_id: "feab65a2-71e0-4566-9690-50602b234c0e"
}
client = SellerLedger.new('your_api_token')
client.update_transaction("580e0c2f-c0d2-4a68-bd87-b6b76abcca01", params)
curl "https://api.sellerledger.com/v1/transactions/580e0c2f-c0d2-4a68-bd87-b6b76abcca01" \
-H "Authorization: token your_api_token" \
-H "Content-Type: application/json" \
-d '{"transaction_date": "2024-05-04 12:00:00", "transacted_with": "Sally and Bob's", "description": "Sold supplies and sundries", "currency_code": "USD", "amount": 151.42, "category_id": "feab65a2-71e0-4566-9690-50602b234c0e"}'
-X PUT
The above command returns JSON structured like this:
{
"transaction": {
"transaction_type": "financial",
"transaction_id": "580e0c2f-c0d2-4a68-bd87-b6b76abcca01",
"transaction_date": "2024-05-04T12:00:00.000Z",
"transacted_with": "Sally and Bob's",
"description": "Sold supplies and sundries",
"amount": 151.42,
"currency_code": "USD",
"category": {
"id": "feab65a2-71e0-4566-9690-50602b234c0e",
"name": "Other Income",
"type": "Income"
}
}
}
This endpoint updates an existing financial transaction.
HTTP Request
PUT https://api.sellerledger.com/v1/transactions/<ID>
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
ID | Yes | String | n/a |
connection_id | No | String | A connection ID for this transaction. |
transaction_id | Yes | String | The originally provided or generated ID for this financial transaction |
transaction_date | Yes | Date Time | UTC Date time for when this transaction took place |
transacted_with | Yes | String | Merchant or vendor name this transaction happened with |
description | Yes | String | Brief description of the transaction |
currency_code | Yes | String | Abbreviated currency code (USD) |
amount | Yes | Float | Transaction total amount |
category_id | Yes | String | Seller Ledger Category ID for this transaction. See the categories documentation. |
Delete a transaction
curl "https://api.sellerledger.com/v1/transactions/580e0c2f-c0d2-4a68-bd87-b6b76abcca01" \
-H "Authorization: token your_api_token" \
-X DELETE
require 'seller_ledger'
client = SellerLedger.new('your_api_token')
client.delete_transaction('580e0c2f-c0d2-4a68-bd87-b6b76abcca01')
The above command returns JSON structured like this:
{
"transaction": {
"transaction_type": "financial",
"transaction_id": "580e0c2f-c0d2-4a68-bd87-b6b76abcca01",
"transaction_date": "2024-05-04T12:00:00.000Z",
"transacted_with": "Sally and Bob's",
"description": "Sold supplies and sundries",
"amount": 151.42,
"currency_code": "USD",
"category": {
"id": "feab65a2-71e0-4566-9690-50602b234c0e",
"name": "Other Income",
"type": "Income"
}
}
}
This endpoint deletes a specific financial transaction.
HTTP Request
DELETE https://api.sellerledger.com/v1/transactions/<ID>
URL Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
ID | Yes | String | n/a | The ID of the financial transaction to delete |
connection_id | No | String | Filters transaction by this connection ID |