Skip to Content

Save a draft

POST
/v1/ec/drafts

A document to finish or issue later, by a person in the console or by you: the body of the family's POST /v1/ec/{resource}, complete or not. It takes no number, appears in no document list and is sent nowhere until it is issued with POST /v1/ec/drafts/{id}/issue. The console's composer opens it, and saves it back as it is filled in.

Authorization

headerAuthorizationBearer <token>

Your API key, which acts for the one business it was created for: fb_live_… keys work at api.fiscalbase.io and issue in live, and fb_sandbox_… keys work at api-sandbox.fiscalbase.io and issue in sandbox, on the simulated SRI. A key sent to the other host is refused with api_key_wrong_host, which names its host.

Header Parameters

idempotency-key?string

Send the same key to retry safely: a repeat of the same request answers what the first answered, without doing it again. Keys are scoped to your key's business and environment; the same key with another request is 409 idempotency_key_reused.

Length1 <= length <= 255
Fiscalbase-Environment?string

The environment the call acts in. Required with a person's session; a key's own environment is the one that counts, so a key may leave it out, and naming another is 422 environment_mismatch.

Value in"sandbox""test""live"
Fiscalbase-Business?string

The business the call acts for. With a person's session, the one the call is about (without it, a call about one business is 422 business_required and a list covers every business of the organization); a key acts for its own, so naming another is 422 business_mismatch.

Formatuuid
Fiscalbase-Channel?string

Which of Fiscalbase's own integrations a key's call comes from, recorded as the channel of the documents it issues: a record, not a permission. Without it, api. A person's call is always console.

Value in"api""mcp"
Fiscalbase-Agent?string

The AI agent a key's call comes from, as its client names itself (the MCP server sets it); recorded with the request and shown in the console's request log.

Request Body

application/json
  1. body
type*string

The family the document is of: invoice, credit_note, debit_note, withholding, delivery_note or purchase_settlement.

Value in"invoice""credit_note""debit_note""withholding""delivery_note""purchase_settlement"
document*

The body POST /v1/ec/{resource} takes for the draft's type, complete or not: any field may be missing, and the rules that join fields wait until it is issued. What no body could hold is refused at once (422 at document.<path>): a field the body doesn't know, a value of the wrong kind or outside its closed set, or a row (a tax, a withholding) that doesn't say which kind it is.

Response Body

Saved

application/json
  1. response
id*string
Formatuuid
object*"draft"
Value in"draft"
type*string

The family the document is of: invoice, credit_note, debit_note, withholding, delivery_note or purchase_settlement.

Value in"invoice""credit_note""debit_note""withholding""delivery_note""purchase_settlement"
business_id*string
Formatuuid
environment*string
Value in"sandbox""test""live"
document*

The body POST /v1/ec/{resource} takes for the draft's type, complete or not: any field may be missing, and the rules that join fields wait until it is issued. What no body could hold is refused at once (422 at document.<path>): a field the body doesn't know, a value of the wrong kind or outside its closed set, or a row (a tax, a withholding) that doesn't say which kind it is.

created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.fiscalbase.io/v1/ec/drafts' \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "invoice",
  "document": {
    "property1": null,
    "property2": null
  }
}'
Example Response
{
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "object": "draft",
  "type": "invoice",
  "business_id": "f59fcbb7-848d-4242-af07-a8bb7e3ab37c",
  "environment": "sandbox",
  "document": {
    "property1": null,
    "property2": null
  },
  "created_at": "2019-08-24T14:15:22Z",
  "updated_at": "2019-08-24T14:15:22Z"
}