Skip to main content

Import API

Bulk data import endpoints for creating items from external sources (CSV, XLSX, or direct JSON). Supports parts, documents, and issues with branch-aware creation for post-release designs.

Overview​

EndpointMethodAuthDescription
/api/import/partsPOSTAuth requiredBulk import parts (with optional BOM)
/api/import/documentsPOSTAuth requiredBulk import documents
/api/import/issuesPOSTAuth requiredBulk import issues
/api/import/templates/partsGETPublicDownload parts CSV template
/api/import/templates/documentsGETPublicDownload documents CSV template
/api/import/templates/issuesGETPublicDownload issues CSV template

POST /api/import/parts​

Bulk-create parts from an array of row data. Optionally includes BOM relationships that wire up parent-child links between the newly created parts and/or existing parts in the design.

Request Body​

{
"designId": "uuid",
"branchId": "uuid",
"rows": [
{
"name": "Aluminum Housing",
"itemNumber": "PN-000001",
"partType": "Manufacture",
"description": "Main housing for the motor assembly",
"material": "Aluminum 6061-T6",
"weight": "2.5",
"weightUnit": "kg",
"cost": "125.00",
"costCurrency": "USD",
"leadTimeDays": 14,
"revision": "-",
"attributes": { "finish": "anodized" }
}
],
"bomRelationships": [
{
"parentItemNumber": "ASM-001",
"childItemNumber": "PN-000001",
"quantity": 2,
"findNumber": 1,
"referenceDesignator": "R1, R2"
}
],
"bypassBranchProtection": false
}

Parameters​

Top-level fields​

FieldTypeRequiredDescription
designIdUUIDYesTarget design for the imported parts
branchIdUUIDConditionalRequired for post-release designs (unless bypassBranchProtection is true)
rowsArrayYes1-500 part rows to import
bomRelationshipsArrayNoBOM parent-child relationships to create after parts are imported
bypassBranchProtectionbooleanNoIf true, create directly on main even for post-release designs (default: false)

Row fields​

FieldTypeRequiredConstraintsDescription
namestringYes1-500 charsPart name
itemNumberstringNoMax 100 charsItem number (auto-generated if omitted)
revisionstringNo1-10 charsRevision letter (default: -)
descriptionstringNoMax 5000 charsPart description
partTypeenumNoManufacture, Purchase, Software, PhantomPart sourcing type
materialstringNoMax 100 charsMaterial specification
weightstringNo-Weight value
weightUnitstringNoMax 10 charsWeight unit (e.g., kg, lb)
coststringNo-Unit cost
costCurrencystringNoExactly 3 charsISO 4217 currency code (e.g., USD)
leadTimeDaysintegerNo>= 0Procurement lead time in days
attributesobjectNostring keys/valuesCustom attributes from unmapped columns

BOM relationship fields​

FieldTypeRequiredDefaultDescription
parentItemNumberstringYes-Item number of parent assembly
childItemNumberstringYes-Item number of child component
quantitynumberNo1Quantity per assembly (>= 0)
findNumberintegerNo-Find number / sequence in BOM
referenceDesignatorstringNo-Reference designator(s)

Response​

201 Created -- All rows imported successfully.

207 Multi-Status -- Some rows succeeded, some failed.

400 Bad Request -- All rows failed or validation error.

{
"data": {
"result": {
"totalRows": 5,
"successCount": 4,
"errorCount": 1,
"createdItems": [
{ "rowNumber": 2, "itemId": "uuid", "itemNumber": "P-1001" },
{ "rowNumber": 3, "itemId": "uuid", "itemNumber": "P-1002" }
],
"failedRows": [{ "rowNumber": 6, "errors": ["Name is required"] }],
"relationshipsCreated": 3,
"relationshipsFailed": 0,
"failedRelationships": []
}
}
}

Branch-aware import​

The import behavior depends on the design's lifecycle phase:

Design PhasebranchId providedbypassBranchProtectionBehavior
Pre-releaseNo-Creates directly on main
Pre-releaseYes-Creates on specified branch
Post-releaseYesfalseCreates on specified branch via ItemService.createOnBranch
Post-releaseNofalseError: Branch ID required
Post-releaseNotrueCreates directly, bypassing branch protection

BOM relationship resolution​

When bomRelationships are provided, the endpoint:

  1. Builds a map from item numbers to item IDs using newly created items
  2. Searches existing items in the design to resolve parent references not in the import batch
  3. Processes each relationship, creating BOM type links via ItemService.addRelationship
  4. Reports relationship successes and failures separately in the response

POST /api/import/documents​

Bulk-create documents. Follows the same branch-aware pattern as parts import. Additionally enforces design access and branch access checks, and requires the Administrator role to use bypassBranchProtection.

Request Body​

{
"designId": "uuid",
"branchId": "uuid",
"rows": [
{
"name": "Motor Assembly Drawing",
"itemNumber": "DOC-001",
"description": "Assembly drawing for the motor housing",
"docType": "Drawing",
"fileName": "motor-assy.pdf",
"mimeType": "application/pdf"
}
],
"bypassBranchProtection": false
}

Row fields​

FieldTypeRequiredConstraintsDescription
namestringYes1-500 charsDocument name
itemNumberstringNoMax 100 charsItem number (auto-generated if omitted)
revisionstringNo1-10 charsRevision letter (default: -)
descriptionstringNoMax 5000 charsDocument description
docTypeenumNoSpecification, Drawing, Procedure, Manual, Report, OtherDocument category
fileNamestringNoMax 500 charsAssociated file name
mimeTypestringNoMax 100 charsMIME type of associated file
attributesobjectNostring keys/valuesCustom attributes

Response​

Same structure as parts import (without BOM relationship fields).


POST /api/import/issues​

Bulk-create issues. Issues use a free lifecycle (Open state) and do not require design or branch context. They can optionally be associated with a program.

Request Body​

{
"programId": "uuid",
"rows": [
{
"name": "Motor overheating under load",
"severity": "High",
"priority": "Critical",
"category": "Design",
"reportedDate": "2025-01-15",
"description": "Motor temperature exceeds 95C after 30 minutes at full load",
"rootCause": "Insufficient heatsink surface area"
}
]
}

Parameters​

FieldTypeRequiredDescription
programIdUUIDNoAssociate imported issues with a program
rowsArrayYes1-500 issue rows to import

Row fields​

FieldTypeRequiredConstraintsDescription
namestringYes1-500 charsIssue title
itemNumberstringNoMax 100 charsItem number (auto-generated if omitted)
descriptionstringNoMax 10000 charsIssue description
severityenumNoCritical, High, Medium, LowIssue severity
priorityenumNoCritical, High, Medium, LowIssue priority
categoryenumNoDesign, Manufacturing, Quality, Customer, Safety, OtherIssue category
reportedDatestringNoISO date stringDate the issue was reported
resolutionstringNoMax 10000 charsResolution description
rootCausestringNoMax 10000 charsRoot cause analysis
attributesobjectNostring keys/valuesCustom attributes

Response​

Same structure as parts import (without BOM relationship fields).


GET /api/import/templates/:type​

Download a CSV template with headers and an example row for the specified item type.

Endpoints​

URLFile name
/api/import/templates/partsparts-import-template.csv
/api/import/templates/documentsdocuments-import-template.csv
/api/import/templates/issuesissues-import-template.csv

Query Parameters​

ParameterTypeDefaultDescription
formatstringcsvTemplate format. Currently only csv is supported; xlsx falls back to CSV.

Response​

Returns a CSV file download with:

  • Row 1: Column headers (human-readable labels)
  • Row 2: Example values
Item Number,Name,Revision,Description,Type,Material,Weight,Weight Unit,Cost,Currency,Lead Time (Days)
PN-000001,Aluminum Housing,-,Main housing for the motor assembly,Manufacture,Aluminum 6061-T6,2.5,kg,125.00,USD,14

Error responses​

All import endpoints use the standard Cascadia error envelope:

422 Validation Error (request body fails schema validation):

{
"error": {
"code": "VALIDATION_ERROR",
"message": "Name is required; Design ID is required"
}
}

400 Bad Request (all rows failed):

{
"data": {
"result": {
"totalRows": 2,
"successCount": 0,
"errorCount": 2,
"createdItems": [],
"failedRows": [
{ "rowNumber": 2, "errors": ["Duplicate item number"] },
{ "rowNumber": 3, "errors": ["Name is required"] }
]
}
}
}

Limits​

ConstraintValue
Maximum rows per request500
Maximum item number length100 characters
Maximum name length500 characters
Maximum description length5000 characters (10000 for issues)