API Documentation

API Endpoint

Document Types

Document Types

Supported filter params

  • subsidiary_id (array)

  • exportable_type_id (array) (1: invoice, 2: deal, 3: budget)

  • status (1: active, 2: archived)

GET /api/v2/document_types
Requestsreturns, :aggregate_failures document_types

GET  /api/v2/document_types

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": [
    {
      "id": "34",
      "type": "document_types",
      "attributes": {
        "name": "normal invoice",
        "tax1_name": "VAT",
        "tax1_value": "25.0",
        "tax2_name": null,
        "tax2_value": null,
        "locale": "en_US",
        "document_template_id": 1,
        "exportable_type_id": 1,
        "note": null,
        "footer": null,
        "template_options": {},
        "archived_at": null,
        "header_template": null,
        "body_template": null,
        "footer_template": null,
        "scss_template": null,
        "exporter_options": {},
        "email_template": null,
        "email_subject": null,
        "email_data": {},
        "line_item_tax": false,
        "dual_currency": false
      },
      "relationships": {
        "organization": {
          "data": {
            "type": "organizations",
            "id": "411"
          }
        },
        "subsidiary": {
          "meta": {
            "included": false
          }
        },
        "document_style": {
          "meta": {
            "included": false
          }
        },
        "attachments": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ],
  "links": {
    "first": "http://api-test.productive.io/api/v2/document_types?page%5Bnumber%5D=1&page%5Bsize%5D=30",
    "last": "http://api-test.productive.io/api/v2/document_types?page%5Bnumber%5D=1&page%5Bsize%5D=30"
  },
  "meta": {
    "current_page": 1,
    "total_pages": 1,
    "total_count": 1,
    "page_size": 30,
    "max_page_size": 200
  }
}

Get document_types
GET/api/v2/document_types


GET /api/v2/document_types/1
Requestsreturns, :aggregate_failures document_type

GET  /api/v2/document_types/35

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "35",
    "type": "document_types",
    "attributes": {
      "name": "normal invoice",
      "tax1_name": "VAT",
      "tax1_value": "25.0",
      "tax2_name": null,
      "tax2_value": null,
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {},
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "412"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

Gets a document_type
GET/api/v2/document_types/{id}

URI Parameters
HideShow
id
number (required) Example: 1

document type id


POST /api/v2/document_types
Requestscreates, :aggregate_failures document_typereturns errorcreates, :aggregate_failures document_type

POST  /api/v2/document_types

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": "test name",
      "locale": "hr_HR",
      "exportable_type_id": 1
    },
    "relationships": {
      "subsidiary": {
        "data": {
          "type": "subsidiaries",
          "id": "59"
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "37",
    "type": "document_types",
    "attributes": {
      "name": "test name",
      "tax1_name": null,
      "tax1_value": null,
      "tax2_name": null,
      "tax2_value": null,
      "locale": "hr_HR",
      "document_template_id": null,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "413"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

POST  /api/v2/document_types

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": ""
    }
  }
}
Responses422
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "422",
      "code": "invalid_attribute",
      "title": "Invalid Attribute",
      "detail": "can't be blank",
      "source": {
        "pointer": "data/attributes/name"
      }
    },
    {
      "status": "422",
      "code": "invalid_attribute",
      "title": "Invalid Attribute",
      "detail": "can't be blank",
      "source": {
        "pointer": "data/attributes/locale"
      }
    },
    {
      "status": "422",
      "code": "invalid_attribute",
      "title": "Invalid Attribute",
      "detail": "is not included in the list",
      "source": {
        "pointer": "data/attributes/exportable_type_id"
      }
    }
  ]
}

POST  /api/v2/document_types

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": "test name",
      "locale": "hr_HR",
      "exportable_type_id": 1,
      "tax1_value": 2.34567,
      "tax2_value": 5.12345
    },
    "relationships": {
      "subsidiary": {
        "data": {
          "type": "subsidiaries",
          "id": "61"
        }
      }
    }
  }
}
Responses201
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "40",
    "type": "document_types",
    "attributes": {
      "name": "test name",
      "tax1_name": null,
      "tax1_value": "2.35",
      "tax2_name": null,
      "tax2_value": "5.12",
      "locale": "hr_HR",
      "document_template_id": null,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "415"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

Create a document_type
POST/api/v2/document_types

URI Parameters
HideShow
name
string (required) Example: Name

name

locale
string (required) Example: en_US

locale

subsidiary_id
number (required) Example: 1

subsidiary id


PATCH /api/v2/document_types/1
Requestsupdates, :aggregate_failures document_typeupdates, :aggregate_failures document_typeupdates, :aggregate_failures document_typereturns errorupdates, :aggregate_failures document_typeupdates, :aggregate_failures document_type

PATCH  /api/v2/document_types/41

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": "new name"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "41",
    "type": "document_types",
    "attributes": {
      "name": "new name",
      "tax1_name": "VAT",
      "tax1_value": "25.0",
      "tax2_name": null,
      "tax2_value": null,
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "416"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

PATCH  /api/v2/document_types/42

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "tax1_value": 0,
      "tax2_value": null
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "42",
    "type": "document_types",
    "attributes": {
      "name": "Standard Document Type",
      "tax1_name": "VAT",
      "tax1_value": "0.0",
      "tax2_name": null,
      "tax2_value": null,
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "417"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

PATCH  /api/v2/document_types/43

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "document_style_id": null
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "43",
    "type": "document_types",
    "attributes": {
      "name": "Standard Document Type",
      "tax1_name": "VAT",
      "tax1_value": "25.0",
      "tax2_name": null,
      "tax2_value": null,
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "418"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

PATCH  /api/v2/document_types/44

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": ""
    }
  }
}
Responses422
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "errors": [
    {
      "status": "422",
      "code": "invalid_attribute",
      "title": "Invalid Attribute",
      "detail": "can't be blank",
      "source": {
        "pointer": "data/attributes/name"
      }
    }
  ]
}

PATCH  /api/v2/document_types/45

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": "new name"
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "45",
    "type": "document_types",
    "attributes": {
      "name": "new name",
      "tax1_name": "VAT",
      "tax1_value": "5.12345",
      "tax2_name": null,
      "tax2_value": "2.34567",
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "420"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

PATCH  /api/v2/document_types/46

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Body
{
  "data": {
    "type": "document_types",
    "attributes": {
      "name": "new name",
      "tax1_value": 3.45678,
      "tax2_value": 6.12345
    }
  }
}
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "46",
    "type": "document_types",
    "attributes": {
      "name": "new name",
      "tax1_name": "VAT",
      "tax1_value": "3.46",
      "tax2_name": null,
      "tax2_value": "6.12",
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": null,
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {
        "subject": null,
        "template": null
      },
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "421"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

Update a document_type
PATCH/api/v2/document_types/{id}

URI Parameters
HideShow
id
number (required) Example: 1

document type id


PATCH /api/v2/document_types/1/archive
Requestsarchives, :aggregate_failures document type

PATCH  /api/v2/document_types/47/archive

Headers
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Content-Type: application/vnd.api+json
Responses200
Headers
Content-Type: application/vnd.api+json; charset=utf-8
Body
{
  "data": {
    "id": "47",
    "type": "document_types",
    "attributes": {
      "name": "normal invoice",
      "tax1_name": "VAT",
      "tax1_value": "25.0",
      "tax2_name": null,
      "tax2_value": null,
      "locale": "en_US",
      "document_template_id": 1,
      "exportable_type_id": 1,
      "note": null,
      "footer": null,
      "template_options": {},
      "archived_at": "2024-04-19T06:05:19.000+02:00",
      "header_template": null,
      "body_template": null,
      "footer_template": null,
      "scss_template": null,
      "exporter_options": {},
      "email_template": null,
      "email_subject": null,
      "email_data": {},
      "line_item_tax": false,
      "dual_currency": false
    },
    "relationships": {
      "organization": {
        "data": {
          "type": "organizations",
          "id": "422"
        }
      },
      "subsidiary": {
        "meta": {
          "included": false
        }
      },
      "document_style": {
        "meta": {
          "included": false
        }
      },
      "attachments": {
        "meta": {
          "included": false
        }
      }
    }
  },
  "meta": {}
}

Archives a document type
PATCH/api/v2/document_types/{id}/archive

URI Parameters
HideShow
id
number (required) Example: 1

document type id


Generated by aglio on 19 Apr 2024