Recurrence

Recurrences in Space Invoices are created for Documents and help automate the periodic creation of documents based on the original document's content. The system updates the document's dates and numbers during each recurrence, ensuring accurate records for each iteration.

Recurrences are especially useful for businesses with repetitive transactions or subscription-based services. They streamline the invoicing process and save time by automatically generating documents for recurring payments or services, allowing you to focus on other aspects of your business.

Endpoints:

  • POST /v1/Documents/:id/recurrence
  • GET /v1/Recurrences/:id
  • GET /v1/Organizations/:id/recurrences
  • GET /v1/Organizations/:id/recurrences/count
  • PUT /v1/Recurrences/:id
  • DELETE /v1/Recurrences/:id
  • GET /v1/Documents/:id/recurrence

The Recurrence object

Parameters

  • id string readonly

  • name string

  • type string

  • dateFirst date

  • numRecurrences number

  • documentId string

  • Additional propertiesExpand all
    
      {
  "name": "string",
  "type": "string",
  "dateFirst": "2022-04-20T10:10:30+00:00Z",
  "numRecurrences": 42,
  "autoSend": false,
  "notify": true,
  "saveAsDraft": false,
  "id": "string",
  "organizationId": "string",
  "documentId": "string",
  "accountId": "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",
  "_recurrenceDates": [{
    "id": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "iteration": 42,
    "documentId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z"
  }]
}    
  

Create Recurrence for Document

POST /v1/Documents/:id/recurrence

Parameters

Path
  • id string required

    Document id

Properties

  • name string required

  • type string required

  • dateFirst date required

  • numRecurrences number required

  • documentId string optional

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Documents/{id}/recurrence', {
  method: 'POST',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    name: 'string',
    type: 'string',
    dateFirst: '2022-04-20T10:10:30+00:00Z',
    numRecurrences: 42,
    autoSend: false,
    notify: true,
    saveAsDraft: false,
    organizationId: 'string',
    documentId: 'string',
    custom: {}
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X POST https://api.spaceinvoices.com/v1/Documents/{id}/recurrence \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string", \
    "type": "string", \
    "dateFirst": "2022-04-20T10:10:30+00:00Z", \
    "numRecurrences": 42, \
    "autoSend": false, \
    "notify": true, \
    "saveAsDraft": false, \
    "organizationId": "string", \
    "documentId": "string", \
    "custom": {}
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Documents/{id}/recurrence'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'name': 'string',
  'type': 'string',
  'dateFirst': '2022-04-20T10:10:30+00:00Z',
  'numRecurrences': 42,
  'autoSend': False,
  'notify': True,
  'saveAsDraft': False,
  'organizationId': 'string',
  'documentId': 'string',
  'custom': {}
}
response = requests.post(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "name": "string",
  "type": "string",
  "dateFirst": "2022-04-20T10:10:30+00:00Z",
  "numRecurrences": 42,
  "autoSend": false,
  "notify": true,
  "saveAsDraft": false,
  "id": "string",
  "organizationId": "string",
  "documentId": "string",
  "accountId": "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",
  "_recurrenceDates": [{
    "id": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "iteration": 42,
    "documentId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z"
  }]
}    
  

Get Recurrence

GET /v1/Recurrences/:id

Parameters

Path
  • id string required

    Model id

Query
  • filter string optional

    Filter defining fields and include - must be a JSON-encoded string ({"something":"value"})

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Recurrences/{id}', {
  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/Recurrences/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

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

Your access token displayed in examples.

Response:

    
      {
  "name": "string",
  "type": "string",
  "dateFirst": "2022-04-20T10:10:30+00:00Z",
  "numRecurrences": 42,
  "autoSend": false,
  "notify": true,
  "saveAsDraft": false,
  "id": "string",
  "organizationId": "string",
  "documentId": "string",
  "accountId": "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",
  "_recurrenceDates": [{
    "id": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "iteration": 42,
    "documentId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z"
  }]
}    
  

Find Recurrences

GET /v1/Organizations/:id/recurrences

Parameters

Path
  • id string required

    Organization id

Query
  • filter string optional

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Organizations/{id}/recurrences', {
  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}/recurrences \
  -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}/recurrences'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
response = requests.get(url, params={}, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      [
  {
    "name": "string",
    "type": "string",
    "dateFirst": "2022-04-20T10:10:30+00:00Z",
    "numRecurrences": 42,
    "autoSend": false,
    "notify": true,
    "saveAsDraft": false,
    "id": "string",
    "organizationId": "string",
    "documentId": "string",
    "accountId": "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",
    "_recurrenceDates": [{
      "id": "string",
      "date": "2022-04-20T10:10:30+00:00Z",
      "iteration": 42,
      "documentId": "string",
      "createdAt": "2022-04-20T10:10:30+00:00Z",
      "updatedAt": "2022-04-20T10:10:30+00:00Z"
    }]
  }
]    
  

Count Recurrences

GET /v1/Organizations/:id/recurrences/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}/recurrences/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}/recurrences/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}/recurrences/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
}    
  

Replace Recurrence

PUT /v1/Recurrences/:id

Parameters

Path
  • id string required

    Model id

Properties

  • name string required

  • type string required

  • dateFirst date required

  • numRecurrences number required

  • documentId string optional

  • Additional propertiesExpand all
      
        const response = await fetch('https://api.spaceinvoices.com/v1/Recurrences/{id}', {
  method: 'PUT',
  headers: {
    'Authorization': 'ACCESS_TOKEN',
    'content-type': 'application/json'
  },
  body: JSON.stringify({
    name: 'string',
    type: 'string',
    dateFirst: '2022-04-20T10:10:30+00:00Z',
    numRecurrences: 42,
    autoSend: false,
    notify: true,
    saveAsDraft: false,
    organizationId: 'string',
    documentId: 'string',
    custom: {}
  })
});      
    

Your access token is displayed in examples.

Prerequisite: npm install node-fetch

        
          curl -X PUT https://api.spaceinvoices.com/v1/Recurrences/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string", \
    "type": "string", \
    "dateFirst": "2022-04-20T10:10:30+00:00Z", \
    "numRecurrences": 42, \
    "autoSend": false, \
    "notify": true, \
    "saveAsDraft": false, \
    "organizationId": "string", \
    "documentId": "string", \
    "custom": {}
  }'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Recurrences/{id}'
headers = {
  'Authorization': 'ACCESS_TOKEN',
  'content-type': 'application/json',
}
params = {
  'name': 'string',
  'type': 'string',
  'dateFirst': '2022-04-20T10:10:30+00:00Z',
  'numRecurrences': 42,
  'autoSend': False,
  'notify': True,
  'saveAsDraft': False,
  'organizationId': 'string',
  'documentId': 'string',
  'custom': {}
}
response = requests.put(url, json=params, headers=headers)        
      

Your access token displayed in examples.

Response:

    
      {
  "name": "string",
  "type": "string",
  "dateFirst": "2022-04-20T10:10:30+00:00Z",
  "numRecurrences": 42,
  "autoSend": false,
  "notify": true,
  "saveAsDraft": false,
  "id": "string",
  "organizationId": "string",
  "documentId": "string",
  "accountId": "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",
  "_recurrenceDates": [{
    "id": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "iteration": 42,
    "documentId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z"
  }]
}    
  

Delete Recurrence

DELETE /v1/Recurrences/:id

Parameters

Path
  • id string required

    Model id

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Recurrences/{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/Recurrences/{id} \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

        
          import requests
url = 'https://api.spaceinvoices.com/v1/Recurrences/{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 Document Recurrences

GET /v1/Documents/:id/recurrence

Parameters

Path
  • id string required

    Document id

Query
  • refresh boolean optional

      
        const response = await fetch('https://api.spaceinvoices.com/v1/Documents/{id}/recurrence', {
  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/Documents/{id}/recurrence \
  -H 'Authorization: ACCESS_TOKEN' \
  -H 'Content-Type: application/json'        
      

Your access token displayed in examples.

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

Your access token displayed in examples.

Response:

    
      {
  "name": "string",
  "type": "string",
  "dateFirst": "2022-04-20T10:10:30+00:00Z",
  "numRecurrences": 42,
  "autoSend": false,
  "notify": true,
  "saveAsDraft": false,
  "id": "string",
  "organizationId": "string",
  "documentId": "string",
  "accountId": "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",
  "_recurrenceDates": [{
    "id": "string",
    "date": "2022-04-20T10:10:30+00:00Z",
    "iteration": 42,
    "documentId": "string",
    "createdAt": "2022-04-20T10:10:30+00:00Z",
    "updatedAt": "2022-04-20T10:10:30+00:00Z"
  }]
}