NAV Navbar
shell javascript csharp
  • Introduction
  • Authentication
  • Accounts
  • Organizations
  • Documents
  • Currencies
  • Clients
  • Items
  • Companies
  • Payments
  • Recurrences
  • Taxes
  • Filters
  • Errors
  • Introduction

    Welcome to Space Invoices API

    Space Invoices is a developer oriented invoicing API. You can use it to create and manage invoices and other types of documents, it also allows you to manage any data related to those documents.

    Visit our website at spaceinvoices.com and sign up for a developer token

    Getting help

    We're here to help in case you get stuck or want to make a request for functionalities. We also encourage our community to help each other that's why we've created a community Slack channel and conveniently called it Space Invaders :), hope to talk to you there!

    Join our Slack community Space Invaders.

    About

    We have language binding in Shell for now, other languages will be added 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.

    While the API is fully operational parts of this documentation are still missing or might change in the near future while we finalise all the aspects of this document and the product. Check back regularly for updates or sign up for our newsletter on our website.

    Authentication

    Authorization token should be used to make calls to the API:

    # With shell, you can just pass the correct header with each request
    curl "https://api.spaceinvoices.com/v1/..."
      -H "Authorization: TOKEN"
    
    var spaceInvoices = new SpaceInvoices('TOKEN');
    
    SpaceConfiguration.SetApiKey("TOKEN");
    

    Make sure to replace TOKEN with your authorization token.

    Space Invoices uses authorization tokens to allow access to the API. A token can be aquired from the developer dashboard Mission Control.

    The API key has to be included in all API requests to the server in a header like this:

    Authorization: TOKEN

    Accounts

    Accounts represent users that can login and access different organizations based on access right.

    Authenticate

    curl "https://api.spaceinvoices.com/v1/accounts/login" \
      -H "Authorization: TOKEN" \
      -d email="rocketman@example.com" \
      -d password="supersecret"
    
    spaceInvoices.accounts.create({
      email: 'rocketman@example.com',
      password: 'supersecret'
    })
    .then(function(account) {
      console.log(account);
    })
    .catch(function(err) {
      console.error(err);
    });
    
    SpaceAccountLoginOptions loginOptions = new SpaceAccountLoginOptions
        {
            Email = "rocketman@example.com",
            Password = "supersecret"
        };
    
    SpaceAccountService accountService = new SpaceAccountService();
    SpaceLogIn login = accountService.LogIn(loginOptions);
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c5a3683ea12d5a67dd0ef2f4c",
      "userId": "5a3683ea12d5a67dd0ef2f4c"
    }
    
    {
      "id": "5a3683ea12d5a67dd0ef2f4c5a3683ea12d5a67dd0ef2f4c",
      "userId": "5a3683ea12d5a67dd0ef2f4c"
    }
    
    public class SpaceLogIn
    {
        [JsonProperty("id")]
        public string Id { get; set; }
    
        [JsonProperty("userId")]
        public string UserId { get; set; }
    }
    

    This endpoint authenticates an account and returns an access token that can be used in consecutive calls to the API.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/accounts/login

    Attributes

    email required Chosen email.
    password required Chosen password.

    HTTP Response

    Attributes

    id Generated access token.
    userId ID of authenticated user account.

    Create New Account

    curl "https://api.spaceinvoices.com/v1/accounts" \
      -H "Authorization: TOKEN" \
      -d email="rocketman@example.com" \
      -d password="supersecret"
    
    spaceInvoices.accounts.create({
      email: 'rocketman@example.com',
      password: 'supersecret'
    })
    .then(function(account) {
      console.log(account);
    })
    
    SpaceAccountCreateOptions createOptions = new SpaceAccountCreateOptions
        {
            Email = "rocketman@example.com",
            Password = "supersecret"
        };
    
    SpaceAccountService accountService = new SpaceAccountService();
    SpaceAccount account = accountService.Create(createOptions);
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "email": "rocketman@example.com"
    }
    
    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "email": "rocketman@example.com"
    }
    
    public class SpaceAccount
    {
        [JsonProperty("id")]
        public string Id { get; set; }
    
        [JsonProperty("email")]
        public string Email { get; set; }
    
    }
    

    This endpoint creates a new account.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/accounts

    Attributes

    email required Unique email address.
    password required Password, 8 character minimum, at least one capital letter and one symbol.

    HTTP Response

    Attributes

    id Unique ID of model instance.
    email Provided username.

    Check if an email is unique

    curl "https://api.spaceinvoices.com/v1/accounts/is-unique?email=rocketman@example.com"
    
    spaceInvoices.accounts.isUnique('rocketman@example.com"')
    .then(function(response) {
      console.log(response);
    })
    
    SpaceAccountService accountService = new SpaceAccountService();
    Unique unique = accountService.IsUnique("rocketman@example.com");
    

    Returns:

    {
      "isUnique": true
    }
    
    public class Unique
    {
        [JsonProperty("isUnique")]
        public string IsUnique { get; set; }
    
    }
    

    This endpoint returns a boolean value if email is unique / does not exist in the system yet.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/accounts/is-unique?email=:email

    Query parameters

    email required Email to check.

    HTTP Response

    Attributes

    isUnique Boolean if email is unique.

    Read account details

    curl "https://api.spaceinvoices.com/v1/accounts/:accountId" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.accounts.getById(accountId)
    .then(function(account) {
      console.log(account);
    })
    
    SpaceAccountService accountService = new SpaceAccountService();
    SpaceAccount account = accountService.Details("USER_ID");
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "email": "rocketman@example.com"
    }
    
    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "email": "rocketman@example.com"
    }
    
    public class SpaceAccount
    {
        [JsonProperty("id")]
        public string Id { get; set; }
    
        [JsonProperty("email")]
        public string Email { get; set; }
    
    }
    

    This endpoint returns an Account's details.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/accounts/:id

    Query parameters

    id required ID of Account to return.

    HTTP Response

    Attributes

    id ID of account.
    email Email address of account.

    Organizations

    Any given account can have multiple organizations either by creating them or by being given access to them from other account holders.

    This is especially useful when there is a need to manage multiple organizations as they are created for users that might signup to a certain product.

    An organization holds a reference to most of the information that is created through the API.

    Create New Organization

    curl "https://api.spaceinvoices.com/v1/accounts/:id/organizations" \
      -H "Authorization: TOKEN" \
      -d name="Space Exploration Technologies corp" \
      -d address="Rocket Road" \
      -d city="Hawthorne" \
      -d zip="CA 90250" \
      -d country="USA" \
      -d IBAN="123454321 123454321" \
      -d bank="Bank Of America"
    
    spaceInvoices.organizations.create(accountId, {
      name: "Space Exploration Technologies corp",
      address: "Rocket Road",
      city: "Hawthorne",
      zip: "CA 90250",
      country: "USA",
      IBAN: "123454321 123454321",
      bank: "Bank Of America"
    })
    .then(function(organization) {
      console.log(organization);
    })
    .catch(function(error) {
      console.error(error);
    });
    
    SpaceOrganizationCreateOptions createOptions = new SpaceOrganizationCreateOptions{
        Name = "Space Exploration Technologies corp",
        Address = "Rocket Road",
        City = "Hawthorne",
        Zip = "CA 90250",
        Country = "USA",
        Iban = "123454321 123454321"
    };
    
    SpaceOrganizationService organizationService = new SpaceOrganizationService();
    SpaceOrganization organization = organizationService.Create("USER_ID", createOptions);
    
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "name": "Space Exploration Technologies corp",
      "address": "Rocket Road",
      "city": "Hawthorne",
      "zip": "CA 90250",
      "country": "USA",
      "IBAN": "123454321 123454321",
      "bank": "Bank Of Amerika",
      "_defaults": [
        {
          "name": "image_logo",
          "value": ""
        }, {
          "name": "image_signature",
          "value": ""
        }, {
          "name": "invoice_note",
          "value": "When paying please use reference number [document number].\nPlease transfer the money to bank account [IBAN] open at [bank].\n\nThank you for your business."
        }, {
          "name": "estimate_note",
          "value": "When paying please use reference number [document number].\n
            Please transfer the money to bank account [IBAN] open at [bank]."
        }, {
          "name": "advance_note",
          "value": "Thank you for your payment."
        }, {
          "name": "signature",
          "value": "[organization name]"
        }, {
          "name": "footer",
          "value": "[organization name], [address], [city] [zip], [country]. IBAN: [IBAN] open at [bank]"
        }, {
          "name": "email_reminder",
          "value": "Dear customer,\n\nthis is a friendly reminder that the invoice [document number] is due on [document due].\n\nThank you and best regards,\n[organization name]"
        }, {
          "name": "email_document",
          "value": ""
        }, {
          "name": "currencyId",
          "value": "USD"
        }, {
          "name": "color_main",
          "value": "0082c9"
        }, {
          "name": "invoice_dueDays",
          "value": "30"
        }, {
          "name": "invoice_dueDays",
          "value": "30"
        }
      ],
      "locale": "en",
      "active": true,
      "supportPin": "12345",
      "brand": "space-invoices"
    }
    
    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "name": "Space Exploration Technologies corp",
      "address": "Rocket Road",
      "city": "Hawthorne",
      "zip": "CA 90250",
      "country": "USA",
      "IBAN": "123454321 123454321",
      "bank": "Bank Of Amerika",
      "_defaults": [
        {
          "name": "image_logo",
          "value": ""
        }, {
          "name": "image_signature",
          "value": ""
        }, {
          "name": "invoice_note",
          "value": "When paying please use reference number [document number].\nPlease transfer the money to bank account [IBAN] open at [bank].\n\nThank you for your business."
        }, {
          "name": "estimate_note",
          "value": "When paying please use reference number [document number].\n
            Please transfer the money to bank account [IBAN] open at [bank]."
        }, {
          "name": "advance_note",
          "value": "Thank you for your payment."
        }, {
          "name": "signature",
          "value": "[organization name]"
        }, {
          "name": "footer",
          "value": "[organization name], [address], [city] [zip], [country]. IBAN: [IBAN] open at [bank]"
        }, {
          "name": "email_reminder",
          "value": "Dear customer,\n\nthis is a friendly reminder that the invoice [document number] is due on [document due].\n\nThank you and best regards,\n[organization name]"
        }, {
          "name": "email_document",
          "value": ""
        }, {
          "name": "currencyId",
          "value": "USD"
        }, {
          "name": "color_main",
          "value": "0082c9"
        }, {
          "name": "invoice_dueDays",
          "value": "30"
        }, {
          "name": "invoice_dueDays",
          "value": "30"
        }
      ],
      "locale": "en",
      "active": true,
      "supportPin": "12345",
      "brand": "space-invoices"
    }
    
    public class SpaceOrganization
    {
    
        [JsonProperty("id")]
        public string Id { get; set; }
    
        [JsonProperty("name")]
        public string Name { get; set; }
    
        [JsonProperty("address")]
        public string Address { get; set; }
    
        [JsonProperty("address2")]
        public string Address2 { get; set; }
    
        [JsonProperty("city")]
        public string City { get; set; }
    
        [JsonProperty("zip")]
        public string Zip { get; set; }
    
        [JsonProperty("country")]
        public string Country { get; set; }
    
        [JsonProperty("IBAN")]
        public string Iban { get; set; }
    
        [JsonProperty("bank")]
        public string Bank { get; set; }
    
        [JsonProperty("_defaults")]
        public List<SpaceDefault> Defaults { get; set; }
    
        [JsonProperty("locale")]
        public string Locale { get; set; }
    
        [JsonProperty("active")]
        public bool Active { get; set; }
    
        [JsonProperty("supportPin")]
        public string SupportPin { get; set; }
    
        [JsonProperty("brand")]
        public string Brand { get; set; }
    
    }
    

    This endpoint creates a new organization.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/accounts/:id/organizations

    Query parameters

    id required ID of account.

    Arguments

    name required Name of company or other type of organization.
    address Street or similar address.
    address2 Address line 2.
    city City name.
    zip Zip / post code.
    country required ISO 3166 county. Wikipedia The country parameter is used to apply some smart defaults to the organization being created including default tax rates and texts (both may be effected by taxSubject property in some cases).
    taxSubject default is false Specify if the organization is subject to tax. Property effects creation of default tax rates and texts.
    taxNumber String VAT / GST / etc. tax identification number.
    companyNumber String registration or similar identification number.
    IBAN Bank account number.
    website Website address.
    locale default is en ISO 639-1 locale code. Wikipedia Effects language of default texts and system messages.
    brand default is space-invocies Brand source identification for internal use.

    HTTP Response

    Arguments

    id Unique ID of model instance
    _defaults Array of objects. Collection of organization's default settings. Can be used for custom settings. toggle definition
    name Unique (to orgnization) name of setting.
    value Value of setting.
    active Boolean indicator if organization is active (enabled).
    supportPin 5 digit number used to match organization requesting support.

    Documents

    Documents are the most complex part of Space Invoices, they are the core of our service.

    We have taken a lot of care to provide developers with a wide array of options when creating different documents, most importantly we allow you to provide as much or as little data as you wish while the API takes care of the rest base on known data like organization settings, country of origin and country of destination.

    Create New Document

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/documents" \
      -H "Authorization: TOKEN" \
      -d _documentClient[name]="Rocket Man" \
      -d _documentClient[country]="USA" \
      -d _documentItems[0][name]="Space suit" \
      -d _documentItems[0][quantity]=2 \
      -d _documentItems[0][unit]="Item" \
      -d _documentItems[0][price]="1000"
    
    spaceInvoices.documents.create(organization.id, {
      _documentClient: {
        name: "Rocket Man",
        country: "USA"
      },
      _documentItems: [
        {
          name: "Space suit",
          quantity: 2,
          unit: "Item",
          price: 1000
        }
      ]
    })
    .then(function(document) {
      console.log(document);
    })
    
    SpaceDocumentCreateOptions createOptions = new SpaceDocumentCreateOptions
        {
            DocumentClient = new SpaceDocumentClientOptions
            {
                Name = "Rocket Man",
                Country = "USA"
            },
            DocumentItems = new List<SpaceDocumentItemOptions>{
                new SpaceDocumentItemOptions{
                    Name = "Space Suit",
                    Quantity = 1,
                    Unit = "Item"
                }
            }
        };
    
    SpaceDocumentService documentService = new SpaceDocumentService();
    SpaceDocument document = documentService.Create("ORGANIZATION_ID", createOptions);
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "number": "2018-00001",
      "type": "invoice",
      "date": 2018-01-31,
      "dateService": 2018-01-31,
      "dateDue": 2018-02-31,
      "currencyId": "USD",
      "draft": false,
      "canceled": false,
      "sentEmail": false,
      "_documentIssuer": {
        "name": "Space Exploration Techologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "IBAN": "123454321 123454321",
        "bank": "Bank Of Amerika"
      },
      "clientId": "5a3683ea12d5a67dd0ef2f4d",
      "_documentClient": {
        "name": "Rocket Man",
        "country": "USA"
      },
      "_documentItems": [{
        "id": "5a3683ea12d5a67dd0ef2f4e",
        "name": "Space suit",
        "quantity": 1,
        "unit": "Item",
        "discount": 0,
        "price": 1000,
        "total": 2000,
        "totalWithTax": 2000,
        "totalDiscount": 0,
        "_documenItemTaxes": []
      }],
      "note": "When paying please use reference number [document number].\nPlease transfer the money to bank account [IBAN] open at [bank].\n\nThank you for your business.",
      "signature": "[company name]",
      "footer": "[organization name], [address], [city] [zip], [country]. IBAN: [IBAN] open at [bank]",
      "_documentTaxes": [],
      "_documentReverseTaxes": [],
      "total": 2000,
      "totalDiscount": 0,
      "totalWithTax": 2000,
      "totalPaid": 0,
      "paidInFull": false,
      "_comments": [],
      "createdAt": 2018-01-31T01:20:11.999Z
    }
    
    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "number": "2018-00001",
      "type": "invoice",
      "date": 2018-01-31,
      "dateService": 2018-01-31,
      "dateDue": 2018-02-31,
      "currencyId": "USD",
      "draft": false,
      "canceled": false,
      "sentEmail": false,
      "_documentIssuer": {
        "name": "Space Exploration Techologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "IBAN": "123454321 123454321",
        "bank": "Bank Of Amerika"
      },
      "clientId": "5a3683ea12d5a67dd0ef2f4d",
      "_documentClient": {
        "name": "Rocket Man",
        "country": "USA"
      },
      "_documentItems": [{
        "id": "5a3683ea12d5a67dd0ef2f4e",
        "name": "Space suit",
        "quantity": 1,
        "unit": "Item",
        "discount": 0,
        "price": 1000,
        "total": 2000,
        "totalWithTax": 2000,
        "totalDiscount": 0,
        "_documenItemTaxes": []
      }],
      "note": "When paying please use reference number [document number].\nPlease transfer the money to bank account [IBAN] open at [bank].\n\nThank you for your business.",
      "signature": "[company name]",
      "footer": "[organization name], [address], [city] [zip], [country]. IBAN: [IBAN] open at [bank]",
      "_documentTaxes": [],
      "_documentReverseTaxes": [],
      "total": 2000,
      "totalDiscount": 0,
      "totalWithTax": 2000,
      "totalPaid": 0,
      "paidInFull": false,
      "_comments": [],
      "createdAt": 2018-01-31T01:20:11.999Z
    }
    
    public class SpaceDocument
    {
        [JsonProperty("id")]
        public string Id { get; set; }
    
        [JsonProperty("organizationId")]
        public string OrganizationId { get; set; }
    
        [JsonProperty("number")]
        public string Number { get; set; }
    
        [JsonProperty("type")]
        public string Type { get; set; }
    
        [JsonProperty("date")]
        public DateTime Date { get; set; }
    
        [JsonProperty("dateService")]
        public DateTime DateService { get; set; }
    
        [JsonProperty("dateDue")]
        public DateTime DateDue { get; set; }
    
        [JsonProperty("currencyId")]
        public string CurrencyId { get; set; }
    
        [JsonProperty("draft")]
        public bool Draft { get; set; }
    
        [JsonProperty("canceled")]
        public bool Canceled { get; set; }
    
        [JsonProperty("sentEmail")]
        public bool SentEmail { get; set; }
    
        [JsonProperty("sentSnailMail")]
        public bool SentSnailMail { get; set; }
    
        [JsonProperty("_documentIssuer")]
        public SpaceDocumentIssuer DocumentIssuer { get; set; }
    
        [JsonProperty("clientId")]
        public string ClientId { get; set; }
    
        [JsonProperty("_documentClient")]
        public SpaceDocumentClient DocumentClient { get; set; }
    
        [JsonProperty("_documentItems")]
        public List<SpaceDocumentItem> DocumentItems { get; set; }
    
        [JsonProperty("note")]
        public string Note { get; set; }
    
        [JsonProperty("signature")]
        public string Signature { get; set; }
    
        [JsonProperty("footer")]
        public string Footer { get; set; }
    
        [JsonProperty("_documentTaxes")]
        public List<SpaceDocumentTax> DocumentTaxes { get; set; }
    
        [JsonProperty("_documentReverseTaxes")]
        public List<SpaceDocumentTax> DocumentReverseTaxes { get; set; }
    
        [JsonProperty("total")]
        public decimal Total { get; set; }
    
        [JsonProperty("totalDiscount")]
        public decimal TotalDiscount { get; set; }
    
        [JsonProperty("totalWithTax")]
        public decimal TotalWithTax { get; set; }
    
        [JsonProperty("totalPaid")]
        public decimal TotalPaid { get; set; }
    
        [JsonProperty("paidInFull")]
        public bool PaidInFull { get; set; }
    
        [JsonProperty("_comments")]
        public string[] Comments { get; set; }
    
        [JsonProperty("createdAt")]
        public DateTime CreatedAt { get; set; }
    }
    

    This endpoint creates a new document for given organization.

    This example shows the process of creating an invoice providing minimum data.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/organizations/:id/documents

    Query parameters

    id required ID of Organization.

    Attributes

    number default is YYYY-0000n+1 String, unique (to Document type and Organization) Document number. Auto populated with next number based on document type.
    type default is invoice Type of document (invoice, estimate or advance ). Determines type of document, note that different document types contain different properties, rules and funcionalities. For example invoice can have Payments logged and contains dateService property. Document type cannot be switched once set to instance.
    draft default is false Boolean, if invoice a draft. If set to true the property cannot go back to false. Only present if type is invoice.
    date default is today Javascript date, date of Document. Represents date the Document was issued. Time is trimmed.
    dateDue default is today + default due days Javascript date, date invoice is due. Auto populated using Organization's default due days from today. Only present on type invoice. Time is trimmed.
    dateService Javascript date, date service was started or conducted. Only present on type invoice. Time is trimmed.
    dateServiceTo Javascript date, date service period ends. Only present on type invoice. Time is trimmed.
    currencyId ISO 4217 currency code. Wikipedia If not provided the Organization's default currency is used.
    clientId ID reference to Organization's Client. If provided _documentClient object gets populated using referenced Client.
    _documentClient Object containting client data. Property is optional if clientId is provided. Any key defined in object will be used instead of loaded client data. If clientId is not provided the data in object is saved to Organization's Clients and referenced in document ie. the clientId is auto populated. toggle definition
    name required Name of client. Required only if clientId not provided on Document.
    address Address of Client.
    address2 Address line 2 of Client.
    city City of Client.
    zip Zip / postal code of Client.
    country Country of Client.
    companyNumber String, organization registration or similar number of Client.
    taxNumber String, organization VAT / GST or similar tax number of Client.
    _documentIssuer Object containting issuer data. Property is automatically populated with Organization data. Any key that is provided in object is used instead. toggle definition
    name Name of issuer.
    address Address of issuer.
    address2 Address line 2 of issuer.
    city City of issuer.
    zip Zip / postal code of issuer.
    country Country of issuer.
    companyNumber String, organization registration or similar number of issuer.
    taxNumber String, organization VAT / GST or similar tax number of issuer.
    IBAN Bank account number of issuer.
    bank Bank of issuer.
    website Website address of issuer.
    _documentItems required Collection of objects containing document line items. toggle definition
    itemId ID reference to Organization's item. If provided the item properties are populated from referenced item. Any key that is provided will is used instead.
    name required Name of item. Optional if isSeparator is set to true.
    description Description of item.
    quantity Number, quantity of items.
    unit Unit of measurement for item ie. Item / Service / Meter / etc.
    price Number, price per single item.
    _documentItemTaxes Collection of objects containing item taxes. toggle definition
    taxId ID reference to Organization's Tax. If provided rate, recoverable and compund are auto populated. Note that the rate is chosen based on date property of document if Tax has multiple valid rates.
    rate Number, tax rate percent.
    recoverable Boolean if tax is recoverable.
    reverseCharged Boolean if tax is reverse (self) charged. Reverse charged tax is not applied to totals and is added to document's revese taxes collection.
    compound Boolean if tax is compound. Compund tax is added on top of all other taxes applied to item.
    isSepatator default is false Boolean, indicates if item is separator. Used for visually seaprating line items and naming groups of line items. If true all properties except name and description are ignored.
    note Text note for Document. Populated with Organizaion default if not provided. May contain shortcode notations which get parsed to data on PDF or when parseForDisplay flag is provided.
    signature Text signature for Document. Populated with Organizaion default if not provided. May contain shortcode notations which get parsed to data on PDF or when parseForDisplay flag is provided.
    footer Text footer for Document. Populated with Organizaion default if not provided. May contain shortcode notations which get parsed to data on PDF or when parseForDisplay flag is provided.
    decimalPlaces default is 4 Number of decimal places the Document items are trimmed and rounded to in calculations. Should be 4 in most cases.

    HTTP Response

    Attributes

    id Unique ID of model instance.
    organizationId ID of related organization.
    canceled Boolean, is invoice canceled. Only present if Document type is invoice.
    sentEmail Boolean, has Document been ever sent by email.
    sentSnailMail Boolean, has Document been ever sent by regular post.
    _documentItems Array of objects containing Document items. toggle definition
    total Number, total price of Document item including quantity and discount. Excludes taxes.
    totalTax Number, total value of tax on Document item including quantity, discount and taxes.
    totalWithTax Number, total price of Document item including quantity, discount and taxes.
    totalDiscount Number, total discount of Document item including quantity.
    _documentTaxes Array of objects containing unique Taxes and their amount present on Document. toggle definition
    tax Number, Tax rate percent.
    base Total value used to calculate given Tax.
    totalTax Total value of given Tax on Document.
    _documentReverseTaxes Array of objects containing unique reverse (self) Taxes and their amount present on Document. toggle definition
    tax Number, Tax rate percent.
    base Total value used to calculate given Tax.
    totalTax Total value of given Tax on Document.
    total Number, Document total including all Item totals, excluding Taxes.
    totalDiscount Number, total value of all discounts applied to Document.
    totalWithTax Number, Document total of all Items including Taxes.
    totalPaid Number, total amount of payments logged for invoice. Only present if type is invoice.
    paidInFull Boolean, if Document's logged payments amount to at least it's totalWithTax amount or more. Only present if type is invoice.
    hasUnit Boolean, if Document contains at least one Document item with unit set. Used internaly to more easily determine if unit column needs to be displayed when rendering Document view. Only present if type is invoice.
    _comments Array of objects containing user comments on Document.
    createAt Timestamp of model instance creation.

    List documents

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/documents?filter[where][type]=invoice" \
      -H "Authorization: TOKEN"
    
    var queryParams = {
      filter: {
        where: {
          type: "invoice",
        }
      }
    }
    
    spaceInvoices.documents.list(organizationId, queryParams)
    .then(function(documents) {
      console.log(documents);
    });
    
    var filter = @"{
                      filter: {
                        where: {
                          type: 'invoice'
                        }
                      }
                    }";
    
    SpaceDocumentService documentService = new SpaceDocumentService();
    List<SpaceDocument> documents = documentService.List("ORGANIZATION_ID", filter);
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "number": "2018-00001",
        "type": "invoice",
        "date": 2018-01-31,
        "dateService": 2018-01-31,
        "dateDue": 2018-02-31,
        "currencyId": "USD",
        "draft": false,
        "canceled": false,
        "sentEmail": false,
        "_documentIssuer": {
          "name": "Space Exploration Techologies corp",
          "address": "Rocket Road",
          "city": "Hawthorne",
          "zip": "CA 90250",
          "country": "USA",
          "IBAN": "123454321 123454321",
          "bank": "Bank Of Amerika"
        },
        "clientId": "5a3683ea12d5a67dd0ef2f4d",
        "_documentClient": {
          "name": "Rocket Man",
          "country": "USA"
        },
        "_documentItems": [{
          "id": "5a3683ea12d5a67dd0ef2f4e",
          "name": "Space suit",
          "quantity": 1,
          "unit": "Item",
          "discount": 0,
          "price": 1000,
          "total": 2000,
          "totalWithTax": 2000,
          "totalDiscount": 0,
          "_documenItemTaxes": []
        }],
        "note": "When paying please use reference number 2018-00001.\nPlease transfer the money to bank account 123454321 123454321 open at Bank Of America.\n\nThank you for your business.",
        "signature": "Space Exploration Technologies corp",
        "footer": "Space Exploration Technologies corp, Rocket Road, Hawthorne CA 90250, USA. IBAN: 123454321 123454321 open at Bank Of America",
        "_documentTaxes": [],
        "_documentReverseTaxes": [],
        "total": 2000,
        "totalDiscount": 0,
        "totalWithTax": 2000,
        "totalPaid": 0,
        "paidInFull": false,
        "_comments": [],
        "createdAt": 2018-01-31T01:20:11.999Z
      }
    ]
    
    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "number": "2018-00001",
        "type": "invoice",
        "date": 2018-01-31,
        "dateService": 2018-01-31,
        "dateDue": 2018-02-31,
        "currencyId": "USD",
        "draft": false,
        "canceled": false,
        "sentEmail": false,
        "_documentIssuer": {
          "name": "Space Exploration Techologies corp",
          "address": "Rocket Road",
          "city": "Hawthorne",
          "zip": "CA 90250",
          "country": "USA",
          "IBAN": "123454321 123454321",
          "bank": "Bank Of Amerika"
        },
        "clientId": "5a3683ea12d5a67dd0ef2f4d",
        "_documentClient": {
          "name": "Rocket Man",
          "country": "USA"
        },
        "_documentItems": [{
          "id": "5a3683ea12d5a67dd0ef2f4e",
          "name": "Space suit",
          "quantity": 1,
          "unit": "Item",
          "discount": 0,
          "price": 1000,
          "total": 2000,
          "totalWithTax": 2000,
          "totalDiscount": 0,
          "_documenItemTaxes": []
        }],
        "note": "When paying please use reference number 2018-00001.\nPlease transfer the money to bank account 123454321 123454321 open at Bank Of America.\n\nThank you for your business.",
        "signature": "Space Exploration Technologies corp",
        "footer": "Space Exploration Technologies corp, Rocket Road, Hawthorne CA 90250, USA. IBAN: 123454321 123454321 open at Bank Of America",
        "_documentTaxes": [],
        "_documentReverseTaxes": [],
        "total": 2000,
        "totalDiscount": 0,
        "totalWithTax": 2000,
        "totalPaid": 0,
        "paidInFull": false,
        "_comments": [],
        "createdAt": 2018-01-31T01:20:11.999Z
      }
    ]
    
    List<SpaceDocument>
    

    This endpoint return a list of all Organization's documents optionaly filtered if latter are passed in query params.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/documents

    Query parameters

    id required ID of organization.
    filter Object containing query filters. See Filters section for more details.
    parseShortcodes default is true Boolean, if shortcodes in note, signature and footer should be parsed to their respective values.

    Get Document by ID

    curl "https://api.spaceinvoices.com/v1/documents/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.documents.getById(documentId, queryParams)
    .then(function(document) {
      console.log(document);
    })
    
    var filter = @"{
                      filter: {
                        where: {
                          type: 'invoice'
                        }
                      }
                    }";
    
    SpaceDocumentService documentService = new SpaceDocumentService();
    SpaceDocument document = documentService.GetById("DOCUMENT_ID", filter);
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "number": "2018-00001",
      "type": "invoice",
      "date": 2018-01-31,
      "dateService": 2018-01-31,
      "dateDue": 2018-02-31,
      "currencyId": "USD",
      "draft": false,
      "canceled": false,
      "sentEmail": false,
      "_documentIssuer": {
        "name": "Space Exploration Techologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "IBAN": "123454321 123454321",
        "bank": "Bank Of Amerika"
      },
      "clientId": "5a3683ea12d5a67dd0ef2f4d",
      "_documentClient": {
        "name": "Rocket Man",
        "country": "USA"
      },
      "_documentItems": [{
        "id": "5a3683ea12d5a67dd0ef2f4e",
        "name": "Space suit",
        "quantity": 1,
        "unit": "Item",
        "discount": 0,
        "price": 1000,
        "total": 2000,
        "totalWithTax": 2000,
        "totalDiscount": 0,
        "_documenItemTaxes": []
      }],
      "note": "When paying please use reference number 2018-00001.\nPlease transfer the money to bank account 123454321 123454321 open at Bank Of America.\n\nThank you for your business.",
      "signature": "Space Exploration Technologies corp",
      "footer": "Space Exploration Technologies corp, Rocket Road, Hawthorne CA 90250, USA. IBAN: 123454321 123454321 open at Bank Of America",
      "_documentTaxes": [],
      "_documentReverseTaxes": [],
      "total": 2000,
      "totalDiscount": 0,
      "totalWithTax": 2000,
      "totalPaid": 0,
      "paidInFull": false,
      "_comments": [],
      "createdAt": 2018-01-31T01:20:11.999Z
    }
    
    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "number": "2018-00001",
      "type": "invoice",
      "date": 2018-01-31,
      "dateService": 2018-01-31,
      "dateDue": 2018-02-31,
      "currencyId": "USD",
      "draft": false,
      "canceled": false,
      "sentEmail": false,
      "_documentIssuer": {
        "name": "Space Exploration Techologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "IBAN": "123454321 123454321",
        "bank": "Bank Of Amerika"
      },
      "clientId": "5a3683ea12d5a67dd0ef2f4d",
      "_documentClient": {
        "name": "Rocket Man",
        "country": "USA"
      },
      "_documentItems": [{
        "id": "5a3683ea12d5a67dd0ef2f4e",
        "name": "Space suit",
        "quantity": 1,
        "unit": "Item",
        "discount": 0,
        "price": 1000,
        "total": 2000,
        "totalWithTax": 2000,
        "totalDiscount": 0,
        "_documenItemTaxes": []
      }],
      "note": "When paying please use reference number 2018-00001.\nPlease transfer the money to bank account 123454321 123454321 open at Bank Of America.\n\nThank you for your business.",
      "signature": "Space Exploration Technologies corp",
      "footer": "Space Exploration Technologies corp, Rocket Road, Hawthorne CA 90250, USA. IBAN: 123454321 123454321 open at Bank Of America",
      "_documentTaxes": [],
      "_documentReverseTaxes": [],
      "total": 2000,
      "totalDiscount": 0,
      "totalWithTax": 2000,
      "totalPaid": 0,
      "paidInFull": false,
      "_comments": [],
      "createdAt": 2018-01-31T01:20:11.999Z
    }
    
    public class SpaceDocument
    {
        [JsonProperty("id")]
        public string Id { get; set; }
    
        [JsonProperty("organizationId")]
        public string OrganizationId { get; set; }
    
        [JsonProperty("number")]
        public string Number { get; set; }
    
        [JsonProperty("type")]
        public string Type { get; set; }
    
        [JsonProperty("date")]
        public DateTime Date { get; set; }
    
        [JsonProperty("dateService")]
        public DateTime DateService { get; set; }
    
        [JsonProperty("dateDue")]
        public DateTime DateDue { get; set; }
    
        [JsonProperty("currencyId")]
        public string CurrencyId { get; set; }
    
        [JsonProperty("draft")]
        public bool Draft { get; set; }
    
        [JsonProperty("canceled")]
        public bool Canceled { get; set; }
    
        [JsonProperty("sentEmail")]
        public bool SentEmail { get; set; }
    
        [JsonProperty("sentSnailMail")]
        public bool SentSnailMail { get; set; }
    
        [JsonProperty("_documentIssuer")]
        public SpaceDocumentIssuer DocumentIssuer { get; set; }
    
        [JsonProperty("clientId")]
        public string ClientId { get; set; }
    
        [JsonProperty("_documentClient")]
        public SpaceDocumentClient DocumentClient { get; set; }
    
        [JsonProperty("_documentItems")]
        public List<SpaceDocumentItem> DocumentItems { get; set; }
    
        [JsonProperty("note")]
        public string Note { get; set; }
    
        [JsonProperty("signature")]
        public string Signature { get; set; }
    
        [JsonProperty("footer")]
        public string Footer { get; set; }
    
        [JsonProperty("_documentTaxes")]
        public List<SpaceDocumentTax> DocumentTaxes { get; set; }
    
        [JsonProperty("_documentReverseTaxes")]
        public List<SpaceDocumentTax> DocumentReverseTaxes { get; set; }
    
        [JsonProperty("total")]
        public decimal Total { get; set; }
    
        [JsonProperty("totalDiscount")]
        public decimal TotalDiscount { get; set; }
    
        [JsonProperty("totalWithTax")]
        public decimal TotalWithTax { get; set; }
    
        [JsonProperty("totalPaid")]
        public decimal TotalPaid { get; set; }
    
        [JsonProperty("paidInFull")]
        public bool PaidInFull { get; set; }
    
        [JsonProperty("_comments")]
        public string[] Comments { get; set; }
    
        [JsonProperty("createdAt")]
        public DateTime CreatedAt { get; set; }
    }
    

    This endpoint return a document by it's ID.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/documents/:id

    Query parameters

    id required ID of document.
    filter Object containing query filters. See Filters section for more details.
    parseShortcodes default is true Boolean, if shortcodes in note, signature and footer should be parsed to their respective values.

    Edit document

    Delete document

    Currencies

    Currencies are provided and available to load from our system, if a currency is missing please let us know so we can add it.

    Besides the normal (fiat) currencies we have now also added some common cryptocurrencies.

    Note: ISO 4217 unique currency codes are used as id fields of currencies to simlify inclusion as related IDs in documents.

    Get all Currencies

    curl "https://api.spaceinvoices.com/v1/currencies" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.currency.list()
    .then(function(currencies) {
      console.log(currencies);
    })
    

    Returns:

    [
      {
        "id": "EUR",
        "name": "European Union Euro",
        "symbol": "€",
        "type": "fiat"
      },
      {
        "id": "USD",
        "name": "United States Dollar",
        "symbol": "$",
        "type": "fiat"
      },
      {
        "id": "BTC",
        "name": "Bitcoin",
        "symbol": "₿",
        "type": "crypto"
      },
      {
        "id": "ETH",
        "name": "Ether",
        "symbol": "‎Ξ",
        "type": "crypto"
      }
    ]
    

    This endpoint retrieves all Currencies.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/currencies

    HTTP Response

    Arguments

    id Unique ISO 4217 currency ID of model instance
    name Name of Currency.
    symbol Symbol of currency if available otherwise same as ID.
    type Type of currency. Either fiat or crypto

    Clients

    Clients are businesses, end persons, organizations and any other entity that can receive a document from an organization. They can be saved and later referenced using their unique ID.

    Create New Client

    curl "https://api.spaceinvoices.com/v1/orgnizations/5a3683ea12d5a67dd0ef2f4d/clients" \
      -H "Authorization: TOKEN" \
      -d name="Space Exploration Technologies corp" \
      -d address="Rocket Road" \
      -d city="Hawthorne" \
      -d zip="CA 90250" \
      -d country="USA" \
      -d email="info@spacex.com" \
      -d contact="Elon M." \
      -d phone="+1 123 456 789" \
      -d note="Orders rocket fuel every month."
    
    spaceInvoices.clients.create(organizationId, {
      name: "Space Exploration Technologies corp",
      address: "Rocket Road",
      city: "Hawthorne",
      zip: "CA 90250",
      country: "USA",
      email: "info@spacex.com",
      contact: "Elon M.",
      phone: "+1 123 456 789",
      note: "Orders rocket fuel every month.",
    })
    .then(function(client) {
      console.log(client);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "name": "Space Exploration Technologies corp",
      "address": "Rocket Road",
      "city": "Hawthorne",
      "zip": "CA 90250",
      "country": "USA",
      "email": "info@spacex.com",
      "contact": "Elon M.",
      "phone": "+1 123 456 789",
      "note": "Orders rocket fuel every month."
    }
    

    This endpoint creates a new Client.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/organizations/:id/clients

    Query parameters

    id required ID of Orgniazation for which we are creting the Client.

    Arguments

    name required Name of company, client or other type of organization.
    address Street or similar address.
    address2 Address line 2.
    city City name.
    zip Zip / post code.
    country ISO 3166 county.
    taxSubject default is false Specify if the Client is subject to tax.
    taxNumber String VAT / GST / etc. tax identification number.
    companyNumber String registration or similar identification number.
    email Email address of Client. Used as recipient when sending documents in email.
    contact Name of Client.
    phone Phone number of Client.
    note Text note about Client.

    HTTP Response

    Arguments

    id Unique ID of model instance.

    Update Client

    curl -X PUT "https://api.spaceinvoices.com/v1/clients/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN" \
      -d name="Space Exploration Technologies corp" \
      -d address="Rocket Road" \
      -d city="Hawthorne" \
      -d zip="CA 90250" \
      -d country="USA" \
      -d email="info@spacex.com" \
      -d contact="Elon M." \
      -d phone="+1 123 456 789" \
      -d note="Orders rocket fuel every month."
    
    spaceInvoices.clients.edit(clientId, {
      name: "Space Exploration Technologies corp",
      address: "Rocket Road",
      city: "Hawthorne",
      zip: "CA 90250",
      country: "USA",
      email: "info@spacex.com",
      contact: "Elon M.",
      phone: "+1 123 456 789",
      note: "Orders rocket fuel every month.",
    })
    .then(function(client) {
      console.log(client);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "name": "Space Exploration Technologies corp",
      "address": "Rocket Road",
      "city": "Hawthorne",
      "zip": "CA 90250",
      "country": "USA",
      "email": "info@spacex.com",
      "contact": "Elon M.",
      "phone": "+1 123 456 789",
      "note": "Orders rocket fuel every month."
    }
    

    This endpoint updates a Client by id.

    HTTP Request

    PUT https://api.spaceinvoices.com/v1/clients/:id

    Query parameters

    Arguments

    name required Name of company, client or other type of organization.
    address Street or similar address.
    address2 Address line 2.
    city City name.
    zip Zip / post code.
    country ISO 3166 county.
    taxSubject default is false Specify if the Client is subject to tax.
    taxNumber String VAT / GST / etc. tax identification number.
    companyNumber String registration or similar identification number.
    email Email address of Client. Used as recipient when sending documents in email.
    contact Name of Client.
    phone Phone number of Client.
    note Text note about Client.

    HTTP Response

    Arguments

    Delete Client

    curl -X DELETE "https://api.spaceinvoices.com/v1/clients/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.clients.delete(clientId)
    .then(function(count) {
      console.log(count);
    })
    

    Returns:

    {
      "count": 1
    }
    

    This endpoint soft deletes a Client by id.

    Soft deleted instances stay in database but are not returned on normal calls but can be added by providing deleted: true property in filters.

    HTTP Request

    DELETE https://api.spaceinvoices.com/v1/clients/:id

    Query parameters

    id required ID of Client to delete.

    HTTP Response

    Arguments

    count Number of successfuly deleted items.

    List Clients

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/clients" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.clients.list(organizationId)
    .then(function(clients) {
      console.log(clients);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "name": "Space Exploration Technologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "email": "info@spacex.com",
        "contact": "Elon M.",
        "phone": "+1 123 456 789",
        "note": "Orders rocket fuel every month."
      }
    ]
    

    This endpoint lists Organization's Clients.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/clients

    Query parameters

    id required ID of Organization.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    name Name of company, client or other type of organization.
    address Street or similar address.
    address2 Address line 2.
    city City name.
    zip Zip / post code.
    country ISO 3166 county.
    taxSubject Specify if the Client is subject to tax.
    taxNumber String VAT / GST / etc. tax identification number.
    companyNumber String registration or similar identification number.
    email Email address of Client. Used as recipient when sending documents in email.
    contact Name of Client.
    phone Phone number of Client.
    note Text note about Client.

    Search Clients

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/search-clients?term=Space" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.clients.search(organizationId, 'Space')
    .then(function(clients) {
      console.log(clients);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "name": "Space Exploration Technologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "email": "info@spacex.com",
        "contact": "Elon M.",
        "phone": "+1 123 456 789",
        "note": "Orders rocket fuel every month."
      }
    ]
    

    This endpoint searches for Organization's Clients.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/search-clients?term=:term

    Query parameters

    id required ID of Organization.
    term required String term to search for in Client properties.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    name Name of company, client or other type of organization.
    address Street or similar address.
    address2 Address line 2.
    city City name.
    zip Zip / post code.
    country ISO 3166 county.
    taxSubject Specify if the Client is subject to tax.
    taxNumber String VAT / GST / etc. tax identification number.
    companyNumber String registration or similar identification number.
    email Email address of Client. Used as recipient when sending documents in email.
    contact Name of Client.
    phone Phone number of Client.
    note Text note about Client.

    Items

    Items are items, services and any other thing that a Organization can sell. They can be saved and later referenced using their unique ID.

    Create New Item

    curl "https://api.spaceinvoices.com/v1/orgnizations/5a3683ea12d5a67dd0ef2f4d/items" \
      -H "Authorization: TOKEN" \
      -d name="Space suit" \
      -d description="Best in class suit made from durable composites." \
      -d unit="item" \
      -d price=100 \
      -d taxIds[]="5a3683ea12d5a67dd0ef2f4e"
    
    spaceInvoices.items.create(organizationId, {
      name: "Space suit",
      description: "Best in class suit made from durable composites.",
      unit: "item",
      price: 100,
      taxIds: [taxId]
    })
    .then(function(item) {
      console.log(item);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "name": "Space suit",
      "description": "Best in class suit made from durable composites.",
      "unit": "item",
      "price": 100,
      "taxIds": [ "5a3683ea12d5a67dd0ef2f4e" ]
    }
    

    This endpoint creates a new Item.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/organizations/:id/items

    Query parameters

    id required ID of Orgniazation for which we are creting the Item.

    Arguments

    name required Name of company, item or other type of organization.
    description Description of item.
    unit Unit of measurement.
    price Number price of item.
    taxIds Array of related Tax IDs that the Organization has. The provided taxes will be expanded (loaded from Taxes) and used as default when adding items to documents.

    HTTP Response

    Arguments

    id Unique ID of model instance.

    Update Item

    curl -X PUT "https://api.spaceinvoices.com/v1/items/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN" \
      -d name="Space suit" \
      -d description="Best in class suit made from durable composites." \
      -d unit="item" \
      -d price=100 \
      -d taxIds[]="5a3683ea12d5a67dd0ef2f4e"
    
    spaceInvoices.items.edit(documentId, {
      name: "Space suit",
      description: "Best in class suit made from durable composites.",
      unit: "item",
      price: 100,
      taxIds: [taxId]
    })
    .then(function(item) {
      console.log(item);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "name": "Space suit",
      "description": "Best in class suit made from durable composites.",
      "unit": "item",
      "price": 100,
      "taxIds": [ "5a3683ea12d5a67dd0ef2f4e" ]
    }
    

    This endpoint updates a Item by ID.

    HTTP Request

    PUT https://api.spaceinvoices.com/v1/items/:id

    Query parameters

    Arguments

    name required Name of company, item or other type of organization.
    description Description of item.
    unit Unit of measurement.
    price Number price of item.
    taxIds Array of related Tax IDs that the Organization has. The provided taxes will be expanded (loaded from Taxes) and used as default when adding items to documents.

    HTTP Response

    Arguments

    Delete Item

    curl -X DELETE "https://api.spaceinvoices.com/v1/items/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.items.delete(itemId)
    .then(function(count) {
      console.log(count);
    })
    

    Returns:

    {
      "count": 1
    }
    

    This endpoint soft deletes a Item by ID.

    Soft deleted instances stay in database but are not returned on normal calls but can be added by providing deleted: true property in filters.

    HTTP Request

    DELETE https://api.spaceinvoices.com/v1/items/:id

    Query parameters

    id required ID of Item to delete.

    HTTP Response

    Arguments

    count Number of successfuly deleted items.

    List Items

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/items" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.items.list(organizationId)
    .then(function(items) {
      console.log(items);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "name": "Space suit",
        "description": "Best in class suit made from durable composites.",
        "unit": "item",
        "price": 100,
        "taxIds": [ "5a3683ea12d5a67dd0ef2f4e" ],
        "taxes": [
          {
            "id": "5a3683ea12d5a67dd0ef2f4e",
            "name": "VAT 22%",
            "_taxRates": [
              {
                "id": "e5be3095-4d31-4f09-9ac7-d459a8792621",
                "dateValidFrom": 1970-01-01,
                "rate": 22
              }
            ],
            "recoverable": true,
            "compound": false
          }
        ]
      }
    ]
    

    This endpoint lists Organization's Items.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/items

    Query parameters

    id required ID of Organization.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    id Unique ID of Item model instance.
    organizationId ID of related Organization the Item belongs to.
    name Name of Item.
    description Description of Item.
    unit Unit of measurement of Item.
    price Price of Item.
    taxes Collection of objects containing Item taxes. toggle definition
    name Name of Tax.
    _taxRates Collection of objects containing item taxes. toggle definition
    dateValidFrom Date when Tax Rate is valid from. If Item Tax has multiple Tax Rates, a Rate is selected based on date of document for each document based on the most recent valid Tax Rate.
    rate Number rate of Tax.
    recoverable Booleand indicator if paid Tax can be recovered by Organization.
    compound Booleand indicator if Tax is compound. Compound Tax is calculated on top of Document Item total value including any other Taxes on the item.

    Search Items

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/search-items?term=Space" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.items.search(organizationId, 'space')
    .then(function(items) {
      console.log(items);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "name": "Space suit",
        "description": "Best in class suit made from durable composites.",
        "unit": "item",
        "price": 100,
        "taxIds": [ "5a3683ea12d5a67dd0ef2f4e" ],
        "taxes": [
          {
            "id": "5a3683ea12d5a67dd0ef2f4e",
            "name": "VAT 22%",
            "_taxRates": [
              {
                "id": "e5be3095-4d31-4f09-9ac7-d459a8792621",
                "dateValidFrom": 1970-01-01,
                "rate": 22
              }
            ],
            "recoverable": true,
            "compound": false
          }
        ]
      }
    ]
    

    This endpoint searches for Organization's Items.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/search-items?term=:term

    Query parameters

    id required ID of Organization.
    term required String term to search for in Item properties.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    id Unique ID of Item model instance.
    organizationId ID of related Organization the Item belongs to.
    name Name of Item.
    description Description of Item.
    unit Unit of measurement of Item.
    price Price of Item.
    taxes Collection of objects containing Item taxes. toggle definition
    name Name of Tax.
    _taxRates Collection of objects containing item taxes. toggle definition
    dateValidFrom Date when Tax Rate is valid from. If Item Tax has multiple Tax Rates, a Rate is selected based on date of document for each document based on the most recent valid Tax Rate.
    rate Number rate of Tax.
    recoverable Booleand indicator if paid Tax can be recovered by Organization.
    compound Booleand indicator if Tax is compound. Compound Tax is calculated on top of Document Item total value including any other Taxes on the item.

    Companies

    Companies is a searchable collection of companies and organization we maintain and is available to simplify issuing documents.

    It is recommended to use this database for user interfaces as a search while you type feature but to limit searches to specific countries based on user's origin.

    We are adding to this database slowly country by country. The database is updated regularly as frequently as we can query the data for each country.

    Current status: - [x] Slovenia (production API) - [ ] Hungary (coming soon)

    Accepting votes and data sources for other countries.

    List Companies

    curl "https://api.spaceinvoices.com/v1/companies" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.companies.list()
    .then(function(companies) {
      console.log(companies);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "name": "Space Exploration Technologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "taxNumber": "",
        "taxSubject": true,
        "companyNumber": "123456789"
      }
    ]
    

    This endpoint lists Companies.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/companies

    Query parameters

    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    id Unique ID of Company model instance.
    name Name of Company.
    address Address of Company.
    address2 Address line two of Company.
    city City of Company.
    zip ZIP / post code of Company.
    country Country of Company.
    taxNumber Tax number of Company.
    taxSubject Boolean if Company is subject to VAT / GST or other tax.
    companyNumber Company or other organization registration number.

    Search Companies

    curl "https://api.spaceinvoices.com/v1/companies/search?term=Space" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.companies.search('space')
    .then(function(companies) {
      console.log(companies);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "name": "Space Exploration Technologies corp",
        "address": "Rocket Road",
        "city": "Hawthorne",
        "zip": "CA 90250",
        "country": "USA",
        "taxNumber": "",
        "taxSubject": true,
        "companyNumber": "123456789"
      }
    ]
    

    This endpoint searches for Companies.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/companies/search?term=:term

    Query parameters

    term required String term to search for in Company properties.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    id Unique ID of Company model instance.
    name Name of Company.
    address Address of Company.
    address2 Address line two of Company.
    city City of Company.
    zip ZIP / post code of Company.
    country Country of Company.
    taxNumber Tax number of Company.
    taxSubject Boolean if Company is subject to VAT / GST or other tax.
    companyNumber Company or other organization registration number.

    Payments

    Payments are stored for each invoice. Each invoice can have multiple payments that can also sum up to more that the invoice's total value. Payments are in the Currency of the document.

    Create New Payment

    curl "https://api.spaceinvoices.com/v1/documents/5a3683ea12d5a67dd0ef2f4d/payments" \
      -H "Authorization: TOKEN" \
      -d type="bank" \
      -d date="2018-01-01" \
      -d amount=1000
    
    spaceInvoices.payments.create(documentId, {
      type: "bank",
      date: "2018-01-01",
      amount: 1000
    })
    .then(function(payment) {
      console.log(payment);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "documentId": "5a3683ea12d5a67dd0ef2f4d",
      "organizationId": "5a3683ea12d5a67dd0ef2f4e",
      "type": "bank",
      "date": "2018-01-01",
      "amount": 1000
    }
    

    This endpoint creates a new Payment.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/documents/:id/payments

    Query parameters

    id required ID of Document for which we are creting the Payment.

    Arguments

    type required Type of payment, one of bank / online / paypal / cash / crypto / other.
    date required Number price of payment.
    amount required Amount of Payment.
    description Description of Payment.

    HTTP Response

    Arguments

    id Unique ID of model instance.

    Update Payment

    curl -X PUT "https://api.spaceinvoices.com/v1/payments/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN" \
      -d type="bank" \
      -d date="2018-01-01" \
      -d amount=1000
    
    spaceInvoices.payments.edit(paymentId, {
      type: "bank",
      documentId: documentId,
      date: "2018-01-01",
      amount: 1000
    })
    .then(function(payment) {
      console.log(payment);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "documentId": "5a3683ea12d5a67dd0ef2f4d",
      "organizationId": "5a3683ea12d5a67dd0ef2f4e",
      "type": "bank",
      "date": "2018-01-01",
      "amount": 1000
    }
    

    This endpoint updates a Payment by ID.

    HTTP Request

    PUT https://api.spaceinvoices.com/v1/payments/:id

    Query parameters

    Arguments

    type required Type of payment, one of bank / online / paypal / cash / crypto / other.
    date required Date of payment.
    amount required Amount of Payment.
    description Description of Payment.

    HTTP Response

    Arguments

    Delete Payment

    curl -X DELETE "https://api.spaceinvoices.com/v1/payments/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.payments.delete(paymentId)
    .then(function(count) {
      console.log(count);
    })
    

    Returns:

    {
      "count": 1
    }
    

    This endpoint deletes a Payment by ID.

    HTTP Request

    DELETE https://api.spaceinvoices.com/v1/payments/:id

    Query parameters

    id required ID of Payment to delete.

    HTTP Response

    Arguments

    count Number of successfuly deleted payments.

    List Payments

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/payments" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.payments.list(organizationId)
    .then(function(payments) {
      console.log(payments);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "documentId": "5a3683ea12d5a67dd0ef2f4d",
        "organizationId": "5a3683ea12d5a67dd0ef2f4e",
        "type": "bank",
        "date": "2018-01-01",
        "amount": 1000
      }
    ]
    

    This endpoint lists Organization's Payments.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/payments

    Query parameters

    id required ID of Organization.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    type Type of payment.
    date Date of payment.
    amount Amount of Payment.
    description Description of Payment.

    List a Document's Payments

    curl "https://api.spaceinvoices.com/v1/documents/5a3683ea12d5a67dd0ef2f4d/payments" \
      -H "Authorization: TOKEN"
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "documentId": "5a3683ea12d5a67dd0ef2f4d",
        "organizationId": "5a3683ea12d5a67dd0ef2f4e",
        "type": "bank",
        "date": "2018-01-01",
        "amount": 1000
      }
    ]
    

    This endpoint lists Document's Payments.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/documents/:id/payments

    Query parameters

    id required ID of Document.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    type Type of payment.
    date Date of payment.
    amount Amount of Payment.
    description Description of Payment.

    Recurrences

    Recurrences are created for Documents. A recurrence dictates when a periodic automatic creation of documents using the original document content as a base but changing the dates and number.

    Create New Recurrence

    curl "https://api.spaceinvoices.com/v1/documents/5a3683ea12d5a67dd0ef2f4d/recurrence" \
      -H "Authorization: TOKEN" \
      -d name="Monthly recurrence" \
      -d type="month" \
      -d dateFirst="2018-01-01" \
      -d numRecurrences=2
    
    spaceInvoices.recurrences.create(documentId, {
      name: "Monthly recurrence",
      type: "month",
      dateFirst: "2018-01-01",
      numRecurrences: 2,
    })
    .then(function(recurrence) {
      console.log(recurrence);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "documentId": "5a3683ea12d5a67dd0ef2f4d",
      "organizationId": "5a3683ea12d5a67dd0ef2f4e",
      "accountId": "5a3683ea12d5a67dd0ef2f4f",
      "name": "Monthly recurrence",
      "type": "month",
      "dateFirst": "2018-01-01",
      "numRecurrences": 2,
      "autoSend": false,
      "notify": true,
      "saveAsDraft": false,
      "_recurrenceDates": [
        {
          "date": "2018-01-01",
          "iteration": 1
        }, {
          "date": "2018-02-01",
          "iteration": 2
        }
      ]
    }
    

    This endpoint creates a new Recurrence.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/documents/:id/recurrence

    Query parameters

    id required ID of Document for which we are creting the Recurrence.

    Arguments

    name required Name of recurrence.
    type required Type of recurrence, one of week / month / year.
    dateFirst required Date of first recurrence.
    numRecurrences required Number of Recurrence.
    autoSend Boolean if a created Document should be automaticaly sent to Client when created.
    notify Boolean if Account that created the Recurrence should be notified when a Document is created.
    saveAsDraft Boolean if invoice should be created as draft.
    recurrenceDates Array of objects containing created Recurrence dates. toggle definition
    date Date of Recurrence.
    iteration Number iteration index of Recurrence.

    HTTP Response

    Arguments

    id Unique ID of model instance.

    Delete Recurrence

    curl -X DELETE "https://api.spaceinvoices.com/v1/recurrences/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.recurrences.delete(recurrenceId)
    .then(function(count) {
      console.log(count);
    })
    

    Returns:

    {
      "count": 1
    }
    

    This endpoint deletes a Recurrence by ID.

    HTTP Request

    DELETE https://api.spaceinvoices.com/v1/recurrences/:id

    Query parameters

    id required ID of Recurrence to delete.

    HTTP Response

    Arguments

    count Number of successfuly deleted recurrences.

    List Recurrences

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/recurrence" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.recurrences.list(organizationId)
    .then(function(recurrences) {
      console.log(recurrences);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "documentId": "5a3683ea12d5a67dd0ef2f4d",
        "organizationId": "5a3683ea12d5a67dd0ef2f4e",
        "type": "bank",
        "date": "2018-01-01",
        "amount": 1000
      }
    ]
    

    This endpoint lists Organization's Recurrences.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/recurrence

    Query parameters

    id required ID of Organization.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    type Type of recurrence.
    date Number price of recurrence.
    amount Amount of Recurrence.
    description Description of Recurrence.

    List Recurrences

    curl "https://api.spaceinvoices.com/v1/documents/5a3683ea12d5a67dd0ef2f4d/recurrence" \
      -H "Authorization: TOKEN"
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "documentId": "5a3683ea12d5a67dd0ef2f4d",
        "organizationId": "5a3683ea12d5a67dd0ef2f4e",
        "accountId": "5a3683ea12d5a67dd0ef2f4f",
        "name": "Monthly recurrence",
        "type": "month",
        "dateFirst": "2018-01-01",
        "numRecurrences": 2,
        "autoSend": false,
        "notify": true,
        "saveAsDraft": false,
        "_recurrenceDates": [
          {
            "date": "2018-01-01",
            "iteration": 1
          }, {
            "date": "2018-02-01",
            "iteration": 2
          }
        ]
      }
    ]
    

    This endpoint lists Recurrences.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/documents/:id/recurrence

    Query parameters

    id required ID of Document.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    name Name of recurrence.
    type Type of recurrence.
    dateFirst Date of first recurrence.
    numRecurrences Number of Recurrence.
    autoSend Boolean if a created Document should be automaticaly sent to Client when created.
    notify Boolean if Account that created the Recurrence should be notified when a Document is created.
    saveAsDraft Boolean if invoice should be created as draft.
    recurrenceDates Array of objects containing created Recurrence dates. toggle definition
    date Date of Recurrence.
    iteration Number iteration index of Recurrence.

    Taxes

    Taxes are stored per Organization and are then referenced on Items that need to charge it.

    Taxes have rates applied to them and the rates are chosen based on date of document when they came into force as rates change in countries sometimes.

    Create New Tax

    curl "https://api.spaceinvoices.com/v1/orgnizations/5a3683ea12d5a67dd0ef2f4d/taxes" \
      -H "Authorization: TOKEN" \
      -d name="GST 15" \
      -d _taxRates[][rate]=15
    
    spaceInvoices.taxes.create(organizationId, {
      name: "GST 15",
      _taxRates: [{
        rate: 15
      }]
    })
    .then(function(tax) {
      console.log(tax);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "name": "GST 15",
      "_taxRates": [
        {
          "rate": 15,
          "dateValidFrom": "1970-01-01"
        }
      ],
      "recoverable": true,
      "compound": false,
    }
    

    This endpoint creates a new Tax.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/organizations/:id/taxes

    Query parameters

    id required ID of Orgniazation for which we are creting the Tax.

    Arguments

    name required Name of Tax.
    _taxRates Array of rates the Tax has. toggle definition
    rate Rate of tax.
    dateValidFrom Date when the rate came into force. Used on Documents to determine which rate should be used based on Document date.
    recoverable Default is true Boolean if Tax is recoverable after being paid.
    compound Default is false Boolean if Tax is compound. _Compound Tax is calculated based on Item price and any other Tax applied to Item.

    HTTP Response

    Arguments

    id Unique ID of model instance.

    Add New Rate to a Tax

    curl "https://api.spaceinvoices.com/v1/taxes/5a3683ea12d5a67dd0ef2f4c/taxRates" \
      -H "Authorization: TOKEN" \
      -d rate=20 \
      -d dateValidFrom="2018-01-01"
    
    spaceInvoices.taxes.addANewRateToTax(taxId, {
      rate: 20,
      "dateValidFrom": "2018-01-01"
    })
    .then(function(tax) {
      console.log(tax);
    })
    

    Returns:

    {
      "rate": 20,
      "dateValidFrom": "2018-01-01"
    }
    

    This endpoint creates a new Rate for a Tax.

    HTTP Request

    POST https://api.spaceinvoices.com/v1/taxes/:id/taxRates

    Query parameters

    id required ID of Tax for which we are creting the Rate.

    Arguments

    rate Rate of tax.
    dateValidFrom Date when the rate came into force. Used on Documents to determine which rate should be used based on Document date.

    HTTP Response

    Arguments

    Update Tax

    curl -X PUT "https://api.spaceinvoices.com/v1/taxes/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN" \
      -d name="GST 15"
    
    spaceInvoices.taxes.edit(taxId, {
      name: "GST 15",
    })
    .then(function(tax) {
      console.log(tax);
    })
    

    Returns:

    {
      "id": "5a3683ea12d5a67dd0ef2f4c",
      "organizationId": "5a3683ea12d5a67dd0ef2f4d",
      "name": "GST 15",
      "_taxRates": [
        {
          "rate": 15,
          "dateValidFrom": "1970-01-01"
        }
      ],
      "recoverable": true,
      "compound": false,
    }
    

    This endpoint updates a Tax by ID.

    HTTP Request

    PUT https://api.spaceinvoices.com/v1/taxes/:id

    Query parameters

    Arguments

    name required Name of Tax.
    _taxRates Array of rates the Tax has. toggle definition
    rate Rate of tax.
    dateValidFrom Date when the rate came into force. Used on Documents to determine which rate should be used based on Document date.
    recoverable Default is true Boolean if Tax is recoverable after being paid.
    compound Default is false Boolean if Tax is compound. _Compound Tax is calculated based on Item price and any other Tax applied to Item.

    HTTP Response

    Arguments

    Delete Tax

    curl -X DELETE "https://api.spaceinvoices.com/v1/taxes/5a3683ea12d5a67dd0ef2f4c" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.taxes.delete(taxId)
    .then(function(count) {
      console.log(count);
    })
    

    Returns:

    {
      "count": 1
    }
    

    This endpoint deletes a Tax by ID.

    A Tax can only be deleted if it's not used on any Document.

    HTTP Request

    DELETE https://api.spaceinvoices.com/v1/taxes/:id

    Query parameters

    id required ID of Tax to delete.

    HTTP Response

    Arguments

    count Number of successfuly deleted taxes.

    List Taxes

    curl "https://api.spaceinvoices.com/v1/organizations/5a3683ea12d5a67dd0ef2f4d/taxes" \
      -H "Authorization: TOKEN"
    
    spaceInvoices.taxes.list(organizationId)
    .then(function(taxes) {
      console.log(taxes);
    })
    

    Returns:

    [
      {
        "id": "5a3683ea12d5a67dd0ef2f4c",
        "organizationId": "5a3683ea12d5a67dd0ef2f4d",
        "name": "Space suit",
        "description": "Best in class suit made from durable composites.",
        "unit": "tax",
        "price": 100,
        "taxIds": [ "5a3683ea12d5a67dd0ef2f4e" ],
        "taxes": [
          {
            "id": "5a3683ea12d5a67dd0ef2f4e",
            "name": "VAT 22%",
            "_taxRates": [
              {
                "id": "e5be3095-4d31-4f09-9ac7-d459a8792621",
                "dateValidFrom": 1970-01-01,
                "rate": 22
              }
            ],
            "recoverable": true,
            "compound": false
          }
        ]
      }
    ]
    

    This endpoint lists Organization's Taxes.

    HTTP Request

    GET https://api.spaceinvoices.com/v1/organizations/:id/taxes

    Query parameters

    id required ID of Organization.
    filter Object containing query filters. See Filters section for more details.

    HTTP Response

    Arguments

    name required Name of Tax.
    _taxRates Array of rates the Tax has. toggle definition
    rate Rate of tax.
    dateValidFrom Date when the rate came into force. Used on Documents to determine which rate should be used based on Document date.
    recoverable Boolean if Tax is recoverable after being paid.
    compound Boolean if Tax is compound. _Compound Tax is calculated based on Item price and any other Tax applied to Item.

    Filters

    Filters

    # Where
    curl "...?filter[where][type]=invoice"
    # or
    curl "...?filter[where][type][inq]=invoice"
    
    # Include
    curl "...?filter[include]=payments"
    # or
    curl "...?filter[include][tax]=taxRate"
    
    # Fields
    curl "...?filter[fields][type]=true"
    
    # Limit
    curl "...?filter[limit]=5"
    
    # Order
    curl "...?filter[order][date]=ASC"
    
    # Skip
    curl "...?filter[skip]=5"
    
    # Deleted
    curl "...?filter[deleted]=true"
    
    // Where
    var queryParams = {
      filter: {
        where: {
          type: "invoice"
        }
      }
    }
    // or
    var queryParams = {
      filter: {
        where: {
          type: {
            inq: [
              "invoice",
              "advance"
            ]
          }
        }
      }
    }
    
    // Include
    var queryParams = {
      filter: {
        include: 'payments'
      }
    }
    // or
    var queryParams = {
      filter: {
        include: {
          tax: 'taxRate'
        }
      }
    }
    
    // Fields
    var queryParams = {
      filter: {
        fields: {
          type: true
        }
      }
    }
    
    // Limit
    var queryParams = {
      filter: {
        limit: 5
      }
    }
    
    // Order
    var queryParams = {
      filter: {
        order: {
          date: 'ASC'
        }
      }
    }
    
    // Skip
    var queryParams = {
      filter: {
        skip: 5
      }
    }
    
    // Skip
    var queryParams = {
      filter: {
        deleted: true
      }
    }
    

    Space Invoices API uses a filtering mechanism to control how data is queried.

    where Where query filter. Accepts operators, see Where operators section for details.
    include Used to include related models.
    fields Include or exclude certain fields.
    limit Limit amount of data returned.
    order Order results by property.
    skip Number of results to skip.
    deleted Also return deleted records. Only available on models that implement soft delete.

    Where operators

    Where operations work in a similar way as querying a database, there operations can be controleh with the following.

    # Equal
    curl "...?filter[where][type]=invoice"
    
    # And / Or
    curl "...?filter[where][<and|or>][0]=condition1&?filter[where][<and|or>]condition2"
    
    # GT / GTE
    curl "...?filter[where][date][<gt|get>]=2018-04-01T18:30:00.000Z"
    
    # LT / LTE
    curl "...?filter[where][date][<lt|lte>]=2018-04-01T18:30:00.000Z"
    
    # Between
    curl "...?filter[where][date][between][0]=2018-04-01T18:30:00.000Z&filter[where][date][between][1]=2018-04-01T18:30:00.000Z"
    
    # INQ / NIN
    curl "...?filter[where][type][<inq|nin>]=invoice&filter[where][type][<inq|nin>]=estimate"
    
    # Near
    curl "...?filter[where][coordinates][near]=153.536,-28.1"
    # or
    curl "...?filter[where][coordinates][near]=153.536,-28.1&filter[where][coordinates][maxDistance]=5&filter[where][coordinates][unit]=meters"
    
    # NEQ
    curl "...?filter[where][draft][neq]=false"
    
    # LIKE / NLIKE / Options
    curl "...?filter[where][number][like]=2018.*"
    # or
    curl "...?filter[where][number][like]=2018.*&filter[where][number][options]=i"
    
    # Regexp
    curl "...?filter[where][number][regexp]=^2018"
    
    // Equal
    var queryParams = {
      filter: {
        where: {
          type: 'invoice'
        }
      }
    }
    
    // And | Or - Instead of and you can also use or
    var queryParams = {
      filter: {
        where: {
          and: [{
              type: 'invoice'
            }, {
              draft: false
            }
          ]
        }
      }
    }
    // GT / GTE
    var queryParams = {
      filter: {
        where: {
          date: {
            gt: '2018-04-01T18:30:00.000Z'
          }
        }
      }
    }
    
    // LT / LTE
    var queryParams = {
      filter: {
        where: {
          date: {
            lt: '2018-04-01T18:30:00.000Z'
          }
        }
      }
    }
    // Between
    var queryParams = {
      filter: {
        where: {
          date: {
            between: [
              '2017-04-01T18:30:00.000Z',
              '2018-04-01T18:30:00.000Z'
            ]
          }
        }
      }
    }
    // inq / nin
    var queryParams = {
      filter: {
        where: {
          type: {
            inq: [
              "invoice",
              "estimate"
            ]
          }
        }
      }
    }
    // Near
    var queryParams = {
      filter: {
        where: {
          coordinates: {
            near: '153.536,-28.1'
          }
        }
      }
    }
    //or
    var queryParams = {
      filter: {
        where: {
          coordinates: {
            near: '153.536,-28.1',
            maxDistance: 5,
            units: 'meters'
          }
        }
      }
    }
    // NEQ
    var queryParams = {
      filter: {
        where: {
          draft: {
            neq: false
          }
        }
      }
    }
    // LIKE | NLIKE / options
    var queryParams = {
      filter: {
        where: {
          number: {
            like: '2018.*'
          }
        }
      }
    }
    // or
    var queryParams = {
      filter: {
        where: {
          number: {
            like: '2018.*'
            options: i
          }
        }
      }
    }
    // regExp
    var queryParams = {
      filter: {
        where: {
          number: {
            regexp: '2018.*'
          }
        }
      }
    }
    
    = Equivalence.
    and Logical AND operator.
    or Logical OR operator.
    gt, gte Numerical greather than (>); greater than of equal (>=). Valid for numberical and date values. For Geopoint values, the units are in miles by default.
    lt, lte Numerical less than (<); less than or equal (<=). Valid only for numerical and date values. For Geopoint values, the units are in miles by default.
    between True if the value is between the two specified values: greater than or equal to first value and less than or equal to second value.
    inq, nin In / not in an array of values.
    near For geolocations, return the closest points, sorted in order of distance. Use with limit to return the n closest points. maxDistance and unit can also be passed on same level as near to configure the search.
    neq Not equal (!=).
    like, nlike, options: i LIKE / NOT LIKE operators for use with regular expressions with the case insensitive flag.
    regexp Regular expression.

    Errors

    Space Invoices API uses the following error codes:

    Code Meaning
    400 Bad Request Your request is invalid.
    401 Unauthorized Either you are not allowed to access the route or are not authorised for the resource with the given ID.
    404 Not Found The specified route could not be found.
    422 Unprecessable entity The provided data is invalid, usualy that means a validation error. Details about the error are visible in the server response body.
    500 Internal Server Error We had a problem with our server. Try again later.
    503 Service Unavailable We're temporarily offline for maintenance. Please try again later.