BlissNeat
AI-Powered
Sign In Start Free Trial
Menu
Language
Still managing receipts manually?
AI-powered automation • Start saving time today
Start Free Trial

BlissNeat API

BlissNeat APIを使用すると、既存のITインフラストラクチャに経費管理を統合できます。HRシステムから従業員を同期したり、承認済み経費を会計ソフトにエクスポートしたり、カスタム承認ワークフローを構築したりするために使用できます。

すべてのAPIエンドポイントはJSONを返し、認証が必要です。ベースURLは https://blissneat.com/api/ です。

💡 APIが初めての方はまず認証セクションをご覧ください。

認証

BlissNeatはJWT(JSON Web Token)認証を使用しています。すべてのAPIリクエストには、有効なアクセストークンを含む Authorization ヘッダーが必要です。

ステップ1 — トークンの取得

メールアドレスとパスワードをPOSTしてアクセストークン(60分有効)とリフレッシュトークン(7日間有効)を取得します。

curl -X POST https://blissneat.com/api/token/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "you@yourcompany.com",
    "password": "yourpassword"
  }'

ステップ2 — トークンの使用

Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

ステップ3 — トークンの更新

curl -X POST https://blissneat.com/api/token/refresh/ \
  -H "Content-Type: application/json" \
  -d '{"refresh": "your_refresh_token"}'

ベースURL・エラー

すべてのエンドポイントは https://blissneat.com/api/ からの相対パスです。

ステータスコード意味
200成功
201作成完了
400リクエストエラー
401未認証 — トークンがないか期限切れ
403アクセス拒否
404見つかりません

従業員

会社の従業員を管理します。HRシステムとBlissNeatを同期するために使用できます。

GET /api/employees/ 全従業員を取得
curl https://blissneat.com/api/employees/ \
  -H "Authorization: Bearer {token}"
POST /api/employees/ 従業員を追加

新しい従業員アカウントを作成します。BlissNeatは自動的にログイン情報をメールで送信します。

curl -X POST https://blissneat.com/api/employees/ \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "newstaff@acme.com",
    "first_name": "太郎",
    "last_name": "山田",
    "department": "営業",
    "role": "employee"
  }'

領収書

従業員が提出した経費領収書を照会・管理します。

GET /api/receipts/ 領収書一覧を取得
curl "https://blissneat.com/api/receipts/?status=approved" \
  -H "Authorization: Bearer {token}"

承認

プログラムで領収書を承認または却下します。

POST /api/receipts/{id}/approve/ 領収書を承認
curl -X POST https://blissneat.com/api/receipts/101/approve/ \
  -H "Authorization: Bearer {token}"
POST /api/receipts/{id}/reject/ 領収書を却下
curl -X POST https://blissneat.com/api/receipts/101/reject/ \
  -H "Authorization: Bearer {token}" \
  -H "Content-Type: application/json" \
  -d '{"reason": "ビジネス目的の記載がありません"}'

経費ポリシー

GET /api/workflow-policies/ 経費ポリシー一覧
curl https://blissneat.com/api/workflow-policies/ \
  -H "Authorization: Bearer {token}"

エクスポート

GET /api/receipts/export/csv/ CSVエクスポート
curl "https://blissneat.com/api/receipts/export/csv/?status=approved" \
  -H "Authorization: Bearer {token}" \
  -o expenses_export.csv

ユースケース: HRISから従業員を同期

新入社員がHRシステムに登録されたとき、自動的にBlissNeatに追加するPythonスクリプトです。

import requests

BLISSNEAT_API = "https://blissneat.com/api"

def get_token():
    r = requests.post(f"{BLISSNEAT_API}/token/", json={
        "email": "admin@yourcompany.com",
        "password": "yourpassword"
    })
    return r.json()["access"]

def add_employee(token, employee):
    headers = {"Authorization": f"Bearer {token}"}
    requests.post(f"{BLISSNEAT_API}/employees/", headers=headers, json={
        "email": employee["email"],
        "first_name": employee["first_name"],
        "department": employee["department"],
        "role": "employee"
    })
    print(f"追加完了: {employee['email']}")

token = get_token()
add_employee(token, {
    "email": "newperson@acme.com",
    "first_name": "太郎",
    "department": "営業"
})

ユースケース: 会計ソフトへのエクスポート

月末に承認済み経費をCSVでダウンロードし、会計ソフトにインポートします。

import requests

def export_expenses(token):
    headers = {"Authorization": f"Bearer {token}"}
    r = requests.get(
        "https://blissneat.com/api/receipts/export/csv/",
        headers=headers,
        params={"status": "approved"}
    )
    with open("expenses.csv", "wb") as f:
        f.write(r.content)
    print("エクスポート完了: expenses.csv")

token = get_token()
export_expenses(token)

ユースケース: 少額経費の自動承認

一定金額以下の経費を自動承認してマネージャーの作業を削減します。

import requests

AUTO_APPROVE_UNDER = 5000  # 5,000円以下を自動承認

def auto_approve(token):
    headers = {"Authorization": f"Bearer {token}"}
    receipts = requests.get(
        "https://blissneat.com/api/receipts/",
        headers=headers,
        params={"status": "pending"}
    ).json()

    for receipt in receipts:
        amount = float(receipt.get("total_price") or 0)
        if amount < AUTO_APPROVE_UNDER:
            requests.post(
                f"https://blissneat.com/api/receipts/{receipt['id']}/approve/",
                headers=headers
            )
            print(f"自動承認: {receipt['merchant_name']} ¥{amount:.0f}")

token = get_token()
auto_approve(token)