Unit

Units in Space Invoices can represent brands or subdivisions within an organization. Each unit can be configured with unique details such as name, address, and other information. Units can also be customized with their own branding, including PDF templates, logos, and colors, making them an ideal solution for multi-brand businesses or organizations with multiple sub-locations. By utilizing units, you can efficiently manage and maintain separate branding and settings for each division under a single Organization, streamlining your invoicing and accounting processes.

To issue a document for a specific unit within an organization, simply add the "unitId" property to the document data when making an API call. This will ensure that the document is associated with the correct unit, taking into account its unique details and branding. By using the "unitId" property, you can easily manage documents for various units, enabling a more organized and efficient handling of invoicing and accounting within your organization.

Endpoints:

  • POST /v1/Organizations/:id/units
  • GET /v1/Organizations/:id/units
  • GET /v1/Organizations/:id/units/count
  • PATCH /v1/Units/:id
  • DELETE /v1/Units/:id
  • GET /v1/Units/:id/last-doc-number
  • GET /v1/Units/:id/next-doc-number
  • POST /v1/Units/:id/images
  • GET /v1/Units/:id/download-image
  • DELETE /v1/Units/:id/images

The Unit object

Parameters

  • id string readonly

  • name string

  • address string

  • address2 string

  • city string

  • zip string

  • state string

  • country string

  • Additional propertiesExpand all
    
      {
  "name": "string",
  "address": "string",
  "address2": "string",
  "city": "string",
  "zip": "string",
  "state": "string",
  "country": "string",
  "countryAlpha2Code": "string",
  "taxNumber": "string",
  "taxSubject": true,
  "companyNumber": "string",
  "IBAN": "string",
  "bank": "string",
  "SWIFT": "string",
  "website": "string",
  "email": "string",
  "phone": "string",
  "businessType": "string",
  "id": "string",
  "organizationId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {},
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "_data": [{
    "id": "string",
    "name": "string",
    "value": {},
    "options": {}
  }]
}    
  

Create Unit

POST /v1/Organizations/:id/units

Parameters

Path
  • id string required

    Organization id

Properties

  • name string required

  • address string optional

  • address2 string optional

  • city string optional

  • zip string optional

  • state string optional

  • country string optional

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/units', {
  method: 'POST',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    name: 'string',
    address: 'string',
    address2: 'string',
    city: 'string',
    zip: 'string',
    state: 'string',
    country: 'string',
    countryAlpha2Code: 'string',
    taxNumber: 'string',
    taxSubject: true,
    companyNumber: 'string',
    IBAN: 'string',
    bank: 'string',
    SWIFT: 'string',
    website: 'string',
    email: 'string',
    phone: 'string',
    businessType: 'string',
    custom: {},
    _data: [{
      name: 'string',
      value: {},
      options: {}
    }]
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X POST https://api.spaceinvoices.com/v1/Organizations/{id}/units \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string", \
    "address": "string", \
    "address2": "string", \
    "city": "string", \
    "zip": "string", \
    "state": "string", \
    "country": "string", \
    "countryAlpha2Code": "string", \
    "taxNumber": "string", \
    "taxSubject": true, \
    "companyNumber": "string", \
    "IBAN": "string", \
    "bank": "string", \
    "SWIFT": "string", \
    "website": "string", \
    "email": "string", \
    "phone": "string", \
    "businessType": "string", \
    "custom": {}, \
    "_data": [{ \
      "name": "string", \
      "value": {}, \
      "options": {}
    }]
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/units'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'name': 'string',
  'address': 'string',
  'address2': 'string',
  'city': 'string',
  'zip': 'string',
  'state': 'string',
  'country': 'string',
  'countryAlpha2Code': 'string',
  'taxNumber': 'string',
  'taxSubject': True,
  'companyNumber': 'string',
  'IBAN': 'string',
  'bank': 'string',
  'SWIFT': 'string',
  'website': 'string',
  'email': 'string',
  'phone': 'string',
  'businessType': 'string',
  'custom': {},
  '_data': [{
    'name': 'string',
    'value': {},
    'options': {}
  }]
}
response = requests.post(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "name": "string",
  "address": "string",
  "address2": "string",
  "city": "string",
  "zip": "string",
  "state": "string",
  "country": "string",
  "countryAlpha2Code": "string",
  "taxNumber": "string",
  "taxSubject": true,
  "companyNumber": "string",
  "IBAN": "string",
  "bank": "string",
  "SWIFT": "string",
  "website": "string",
  "email": "string",
  "phone": "string",
  "businessType": "string",
  "id": "string",
  "organizationId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {},
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "_data": [{
    "id": "string",
    "name": "string",
    "value": {},
    "options": {}
  }]
}    
  

Find Units

GET /v1/Organizations/:id/units

Parameters

Path
  • id string required

    Organization id

Query
  • filter string optional

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/units', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Organizations/{id}/units \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/units'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      [
  {
    "name": "string",
    "address": "string",
    "address2": "string",
    "city": "string",
    "zip": "string",
    "state": "string",
    "country": "string",
    "countryAlpha2Code": "string",
    "taxNumber": "string",
    "taxSubject": true,
    "companyNumber": "string",
    "IBAN": "string",
    "bank": "string",
    "SWIFT": "string",
    "website": "string",
    "email": "string",
    "phone": "string",
    "businessType": "string",
    "id": "string",
    "organizationId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z",
    "custom": {},
    "deletedAt": "2022-04-20T10:10:30+00:00Z",
    "_isDeleted": false,
    "deletedId": "string",
    "_data": [{
      "id": "string",
      "name": "string",
      "value": {},
      "options": {}
    }]
  }
]    
  

Count Units

GET /v1/Organizations/:id/units/count

Parameters

Path
  • id string required

    Organization id

Query
  • where string optional

    Criteria to match model instances

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/units/count', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Organizations/{id}/units/count \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Organizations/{id}/units/count'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "count": 42
}    
  

Patch Unit

PATCH /v1/Units/:id

Parameters

Path
  • id string required

    Unit id

Properties

  • name string required

  • address string optional

  • address2 string optional

  • city string optional

  • zip string optional

  • state string optional

  • country string optional

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}', {
  method: 'PATCH',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    name: 'string',
    address: 'string',
    address2: 'string',
    city: 'string',
    zip: 'string',
    state: 'string',
    country: 'string',
    countryAlpha2Code: 'string',
    taxNumber: 'string',
    taxSubject: true,
    companyNumber: 'string',
    IBAN: 'string',
    bank: 'string',
    SWIFT: 'string',
    website: 'string',
    email: 'string',
    phone: 'string',
    businessType: 'string',
    custom: {},
    _data: [{
      name: 'string',
      value: {},
      options: {}
    }]
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X PATCH https://api.spaceinvoices.com/v1/Units/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string", \
    "address": "string", \
    "address2": "string", \
    "city": "string", \
    "zip": "string", \
    "state": "string", \
    "country": "string", \
    "countryAlpha2Code": "string", \
    "taxNumber": "string", \
    "taxSubject": true, \
    "companyNumber": "string", \
    "IBAN": "string", \
    "bank": "string", \
    "SWIFT": "string", \
    "website": "string", \
    "email": "string", \
    "phone": "string", \
    "businessType": "string", \
    "custom": {}, \
    "_data": [{ \
      "name": "string", \
      "value": {}, \
      "options": {}
    }]
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'name': 'string',
  'address': 'string',
  'address2': 'string',
  'city': 'string',
  'zip': 'string',
  'state': 'string',
  'country': 'string',
  'countryAlpha2Code': 'string',
  'taxNumber': 'string',
  'taxSubject': True,
  'companyNumber': 'string',
  'IBAN': 'string',
  'bank': 'string',
  'SWIFT': 'string',
  'website': 'string',
  'email': 'string',
  'phone': 'string',
  'businessType': 'string',
  'custom': {},
  '_data': [{
    'name': 'string',
    'value': {},
    'options': {}
  }]
}
response = requests.patch(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "name": "string",
  "address": "string",
  "address2": "string",
  "city": "string",
  "zip": "string",
  "state": "string",
  "country": "string",
  "countryAlpha2Code": "string",
  "taxNumber": "string",
  "taxSubject": true,
  "companyNumber": "string",
  "IBAN": "string",
  "bank": "string",
  "SWIFT": "string",
  "website": "string",
  "email": "string",
  "phone": "string",
  "businessType": "string",
  "id": "string",
  "organizationId": "string",
  "createdAt": "2022-04-20T10:10:30+00:00Z",
  "updatedAt": "2022-04-20T10:10:30+00:00Z",
  "custom": {},
  "deletedAt": "2022-04-20T10:10:30+00:00Z",
  "_isDeleted": false,
  "deletedId": "string",
  "_data": [{
    "id": "string",
    "name": "string",
    "value": {},
    "options": {}
  }]
}    
  

Delete Unit

DELETE /v1/Units/:id

Parameters

Path
  • id string required

    Model id

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}', {
  method: 'DELETE',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X DELETE https://api.spaceinvoices.com/v1/Units/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.delete(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "count": 1
}    
  

Get last Documents number

GET /v1/Units/:id/last-doc-number

Parameters

Path
  • id string required

    Unit id

Query
  • type string required

    The type of document

  • incoming boolean optional

    Incoming document

  • date date optional

    Date if not in current year

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}/last-doc-number', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Units/{id}/last-doc-number \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}/last-doc-number'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "number": "string"
}    
  

Get next Documents number

GET /v1/Units/:id/next-doc-number

Parameters

Path
  • id string required

    Unit id

Query
  • type string required

    The type of document

  • incoming boolean optional

    Incoming document

  • date date optional

    Date if not in current year

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}/next-doc-number', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Units/{id}/next-doc-number \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}/next-doc-number'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "number": "string"
}    
  

Upload Unit Image

POST /v1/Units/:id/images

Parameters

Path
  • id string required

    Unit id

Properties

  • type string required

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}/images', {
  method: 'POST',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    type: 'string'
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X POST https://api.spaceinvoices.com/v1/Units/{id}/images \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "string"
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}/images'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'type': 'string'
}
response = requests.post(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {

}    
  

Download Unit Images

GET /v1/Units/:id/download-image

Parameters

Path
  • id string required

    Unit id

Query
  • type string required

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}/download-image', {
  method: 'GET',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X GET https://api.spaceinvoices.com/v1/Units/{id}/download-image \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}/download-image'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {

}    
  

Delete Unit Images

DELETE /v1/Units/:id/images

Parameters

Path
  • id string required

    Unit id

Query
  • type string required

    Type of image to delete

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Units/{id}/images', {
  method: 'DELETE',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  }
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X DELETE https://api.spaceinvoices.com/v1/Units/{id}/images \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Units/{id}/images'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.delete(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "count": 1
}