Miare
Miare API

Accounting

Estimates, seller registration, invoices and financial reconciliation.


Estimate Price

GET
https://www.miare.ir
/api/accounting/estimate/price/

Estimates the delivery cost of the course based on the distance between the given source and destination.

The output price is not accurate; it might be affected by the applied conditions at the request time.

The output price is only the course's cost. The final cost includes a trip cost as well. For more information contant the sales team.

This estimate does not include Boost. Include the amount of the selected boost level when calculating the total delivery cost, together with the other trip-level costs described above.

Errors

CodeDescription
not_authenticatedToken is missing or invalid
invalidThe given query params are not valid

Estimate Price › query Parameters

source
​string · required

Latitude and Longitude of the source of the course. The order matters

destination
​string · required

Latitude and Longitude of the destination of the course. The order matters

Estimate Price › Responses

Successful response.

price
​integer · required

Estimated course delivery cost, in Tomans. Excludes trip-level costs and boost.

status
​string · required
area_coverage
​boolean · required

Register or Update Seller

PUT
https://www.miare.ir
/api/accounting/sellers/{seller_id}/

Registers the legal identity of a seller for proxy invoicing, or updates an existing seller with the same seller_id. Seller identifiers are unique within the authenticated client.

This endpoint is available only for clients with proxy invoicing enabled. Register the seller before using its ID as pickup.seller_id in the Create Trip request.

Both creation and update return HTTP 201. When updating, omitted optional fields keep their existing values; sending an optional field as null clears it when validation permits.

Errors

CodeDescription
not_authenticatedToken is missing or invalid
invalid_request_bodyRequest body or seller legal data is invalid
not_foundProxy invoicing is not enabled for the authenticated client

Register or Update Seller › path Parameters

seller_id
​string · maxLength: 64 · required

The seller id belonging to the authenticated client.

Register or Update Seller › Request Body

For individuals national_id is required; legal sellers need national_id or economic_id. On update, omitted optional fields retain their values and null clears them when validation permits.
person_type
​string · enum · required
Enum values:
individual
legal
address
​string · maxLength: 4096 · required
name
​null | string · maxLength: 255
national_id
​null | string · maxLength: 16

Required for an individual. A legal seller needs national_id or economic_id.

registration_number
​null | string · maxLength: 16
economic_id
​null | string · maxLength: 16

A legal seller needs national_id or economic_id.

postal_code
​null | string · maxLength: 10
phone_number
​null | string · maxLength: 20

Register or Update Seller › Responses

Successful response.

person_type
​string · enum · required
Enum values:
individual
legal
name
​null | string · maxLength: 255 · required
national_id
​null | string · maxLength: 16 · required

Required for an individual. A legal seller needs national_id or economic_id.

registration_number
​null | string · maxLength: 16 · required
economic_id
​null | string · maxLength: 16 · required

A legal seller needs national_id or economic_id.

address
​string · maxLength: 4096 · required
postal_code
​null | string · maxLength: 10 · required
phone_number
​null | string · maxLength: 20 · required
seller_id
​string · maxLength: 64 · required
created_at
​string · pattern: ^\d{4}-\d{2}-\d{2}T\… · required

Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.

updated_at
​string · pattern: ^\d{4}-\d{2}-\d{2}T\… · required

Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.


Get Trip Invoice

GET
https://www.miare.ir
/api/accounting/financial-details/{batch_id}/invoice/

Returns the latest available proxy-invoice revision for a batch, or a specific revision when requested. The original invoice is revision 0; later adjustments use increasing revision numbers.

This endpoint is available only for clients with proxy invoicing enabled. The batch_id must belong to the authenticated client. Omit revision to request the latest revision.

The endpoint is read-only. While an invoice is being generated, poll again after the number of seconds returned in retry_after or the Retry-After response header.

Errors

HTTP statusDescription
400revision is not a non-negative integer
401Token is missing or invalid
404Proxy invoicing is disabled, or the batch is unknown or belongs to another client
409The batch belongs to the client, but no invoice exists or the requested revision is unavailable
503Invoice generation reached a terminal failure

Get Trip Invoice › path Parameters

batch_id
​string · uuid · required

The batch id belonging to the authenticated client.

Get Trip Invoice › query Parameters

revision
​integer · min: 0

Non-negative revision number. Use 0 for the original; omit it for the latest.

Get Trip Invoice › Responses

Successful response.

status
​string · enum · required
Enum values:
ready
batch_id
​string · uuid · required
revision
​integer · min: 0 · required
revisions_count
​integer · min: 0 · required

Highest available revision number; not the number of revisions.

invoice_number
​string · required

Adjustments append -RNN to the original invoice number.

document_type
​string · enum · required
Enum values:
original
adjustment
download_url
​string · uri · required

Temporary private download URL; expires in five minutes.

expires_at
​string · pattern: ^\d{4}-\d{2}-\d{2}T\… · required

Serialized timestamp. Responses may use Z or +HHMM; request timestamps must include a timezone.


Get Financial Detail

GET
https://www.miare.ir
/api/accounting/financial-detail/{batch_id}/

Recover the latest financial snapshot for a batch with your API token. Available only for enabled accounts. This returns the financial webhook fields without event. Use the complete financials.total_cost as authoritative; changes is cumulative and must not be added again. Invoice PDF availability is independent.

Get Financial Detail › path Parameters

batch_id
​string · uuid · required

Get Financial Detail › Responses

Successful response.

Available for enabled client accounts with a configured webhook. financial_calculated reports initial accounting; eligible deleted trips have zero amounts. financial_adjusted reports a non-zero financial change after a course is marked invalid. Deduplicate by (batch_id, revision), retain the highest revision and use the complete total rather than reapplying cumulative changes. Revisions can arrive out of order, including before revision 0. Any non-2xx response or network failure is retried with a 10-second request timeout. Default retry delays are 30,120,300,900,1800 seconds and are configurable. Retries use the stored payload. Recover latest data using GET https://www.miare.ir/api/accounting/financial-detail/{batch_id}/ with the client token; the response omits event. Invoice PDF readiness is independent.
batch_id
​string · uuid · required

Stable accounting batch identifier across revisions; may differ from original trip IDs.

revision
​integer · min: 0 · required

Per-batch revision: 0 initially; increasing positive values for adjustments.

trip_ids
​string[] · unique · required

Unique original client-visible trip IDs, retained after batching.

course_ids
​string[] · required

Courses associated with this calculation; adjustments include invalidated courses for traceability.

bill_numbers
​string[] · unique · required

Unique non-empty bill numbers, not positionally aligned with trip_ids or course_ids.

state
​string · enum · required

Financial state, separate from trip lifecycle state.

Enum values:
calculated
changed
​object · required
​object[] · required

Cumulative adjustment history; empty for the initial calculation.

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
No specific criteria
No specific criteria
Properties for Variant 1:
state
​enum
Enum values:
calculated
revision
​integer · enum
Enum values:
0
changes
​array · maxItems: 0