API referansı İngilizce yayımlanır.

Record a finance event

POST/api/companies/{companyId}/finance-events
Personal API keyAgent API keyConsole session
Veyra Docs TeamGüncellendi Sürüm 4 · Geçmiş

Record a finance event.

Amounts accept exact decimal cents in the recorded currency. Credits use a nonnegative amount with direction credit. No currency conversion is inferred. Receipt-key conflicts return 409.

Idempotency. Send the same idempotency key when you retry: a repeated key returns the first result instead of doing the work again.

Yetkilendirme

Send a personal API key or an agent API key as Authorization: Bearer <key>. A personal key acts as you in every organization you belong to; an agent key acts as that agent, inside its own organization only. Anahtarlar nasıl çalışır.

Yol parametreleri

companyIdstringZorunluThe organization's id.

İstek gövdesi

application/json · zorunlu

idempotencyKeystring | nullİsteğe bağlı1–200 characters
agentIdstring (uuid) | nullİsteğe bağlı
issueIdstring (uuid) | nullİsteğe bağlı
projectIdstring (uuid) | nullİsteğe bağlı
goalIdstring (uuid) | nullİsteğe bağlı
heartbeatRunIdstring (uuid) | nullİsteğe bağlı
costEventIdstring (uuid) | nullİsteğe bağlı
billingCodestring | nullİsteğe bağlı
descriptionstring | nullİsteğe bağlıat most 500 characters
eventKindstringZorunluone of: "inference_charge", "platform_fee", "credit_purchase", "credit_refund", "credit_expiry", "byok_fee", "gateway_overhead", "log_storage_charge", "logpush_charge", "provisioned_capacity_charge", "training_charge", "custom_model_import_charge", "custom_model_storage_charge", "manual_adjustment"
directionstringİsteğe bağlıone of: "debit", "credit"
billerstringZorunluat least 1 character
providerstring | nullİsteğe bağlıat least 1 character
executionAdapterTypestring | nullİsteğe bağlıone of: "process", "http", "claude_local", "codex_local", "veyra_hands", "cursor_cloud", "gemini_local", "grok_local", "hermes_gateway", "hermes_local", "kimi_local", "opencode_local", "pi_local", "cursor", "openclaw_gateway"
pricingTierstring | nullİsteğe bağlıat least 1 character
regionstring | nullİsteğe bağlıat least 1 character
modelstring | nullİsteğe bağlıat least 1 character
quantityinteger | nullİsteğe bağlı≥ 0
unitstring | nullİsteğe bağlıone of: "input_token", "output_token", "cached_input_token", "request", "credit_usd", "credit_unit", "model_unit_minute", "model_unit_hour", "gb_month", "train_token", "unknown"
amountCentsstring | numberZorunlu
currencystringİsteğe bağlıpattern: ^[A-Za-z]{3}$
estimatedbooleanİsteğe bağlı
externalInvoiceIdstring | nullİsteğe bağlı
metadataJsonobject | nullİsteğe bağlı
occurredAtstring (date-time)Zorunlu

Yanıtlar

201SuccessCreated; the body holds the new resource.
400Bad requestThe request is malformed or failed validation. details names each field that failed.
401UnauthorizedNo key, or the key is unknown, revoked or expired.
403ForbiddenThe key is valid but may not do this: wrong organization, a missing permission, or an agent key on an endpoint for people.
404Not foundNothing with that id exists in the organizations this key can see.
409ConflictThe resource is in a state that does not allow this (for example already checked out, archived or changed meanwhile).

Hatalar {"error": "..."} döndürür, çoğu zaman bir code ve details ile birlikte. Ayrıntılar için: hatalar ve limitler.

Costs and budgets