Skip to content

Bulk Import Policy Licenses

Request

Imports multiple policy license rules from a CSV file into the specified policy profile.

CSV Format Requirements:

  • Required Headers: License Short Name, Distribution Type, Linking, Modified, Action
  • All rows are validated before applying any changes (atomic operation)
  • Upsert semantics: updates existing combinations, adds new ones, preserves unmatched existing rows

Valid Values:

  • Distribution Type: Any, Internal, External, Hosted-Any, Hosted for External Use, Hosted for Internal Use
  • Linking: Any, Statically Linked, Dynamically Linked, Not Linked
  • Modified: Any, Yes, No
  • Action: Approve, Reject, No Action

CSV Example:

License Short Name,Distribution Type,Linking,Modified,Action
Apache-2.0,Any,Any,Any,Approve
GPL-3.0,External,Dynamically Linked,No,Reject
MIT,Internal,Any,Any,Approve

Authentication: This API requires a valid JWT Bearer token with Policy Administrator permission.

Try it out is not available for this API. Test using curl or Postman:

curl -H "Authorization: Bearer {JWT_TOKEN}" \
     -F file=@licenses.csv \
     http://localhost:8888/codeinsight/api/policies/{policyId}/bulkImport

Validation Rules:

  • All license short names must exist in the reference data
  • Duplicate combinations within the CSV are rejected
  • Empty rows are skipped
  • If ANY validation error exists, NO changes are applied

Response Details:

  • Success: Returns count of imported/updated rules
  • Failure: Returns detailed row-level validation errors
Security
bearerAuth
Path
policyIdinteger, (int64), >= 1required

ID of the policy profile to import licenses into

Example:1
Bodymultipart/form-data
fileobject(FormDataContentDisposition)required
curl -i -X POST \
  https://codeinsightapi.redocly.app/_mock/swagger/policies/1/bulkImport \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file={"type":"string","parameters":{"property1":"string","property2":"string"},"fileName":"string","creationDate":"2019-08-24T14:15:22Z","modificationDate":"2019-08-24T14:15:22Z","readDate":"2019-08-24T14:15:22Z","size":0,"name":"string"}'

Responses

Import successful or validation errors returned

Bodyapplication/json
successboolean

Indicates whether the import operation was successful

Example:true
messagestring

Descriptive message about the import result

Example:"Import completed successfully."
successCountinteger, (int32)

Number of license rules successfully imported or updated

Example:42
errorCountinteger, (int32)

Number of validation errors encountered

Example:0
errorsArray of objects(PolicyLicenseImportError)

List of validation errors (row-level details)

Response
{ "success": true, "message": "Import completed successfully.", "successCount": 42, "errorCount": 0, "errors": [ {} ] }