Create Custom License

Xray REST APIs

Products
JFrog Xray
Content Type
REST API

Description: Create a custom license that can be used for license compliance management. Custom licenses are user-defined and can be assigned to components for tracking and compliance purposes. The license name must be unique and comply with length constraints.

Since: Xray 3.132.0

Applicable Environment: JFrog SaaS, JFrog Self-Hosted

Security: Requires a valid user with Admin permission.

UsagePOST /api/v1/licensesNames/customLicense

Consumes: application/json

Produces: application/json

Request body:

Name

Type

Required/Optional

Description

name

string

required

License key/identifier.

Maximum length: 128 characters.

Must be unique across all licenses.

full_name

string

optional

Full display name of the license.

text

string

optional

Description or full text of the license.

references

array of strings

optional

Array of URLs or references related to the license.

aliases

array of strings

optional

Array of alternative names for the license.

Each alias has a maximum length of 128 characters.

category

string

optional

License category. Defaults to Uncategorized if not specified.

Valid values include:

  • CLA

  • Copyleft Limited

  • Proprietary Free

  • Permissive

  • Patent License

  • Source-available

  • Free Restricted

  • Unstated License

  • Copyleft

  • Commercial

  • Public Domain

  • Uncategorized

priority

integer

optional

License priority value.

If not specified, the default priority for the category will be used.

Response body:

Name

Type

Description

name

string

License key/identifier.

full_name

string

Full display name of the license.

text

string

Description or full text of the license.

references

array of strings

Array of URLs or references related to the license.

aliases

array of strings

Array of alternative names for the license.

category

string

License category.

isCustom

boolean

Indicates this is a custom license (always true for this endpoint).

priority

integer

License priority (optional; may be included in the response).

default_priority

integer

Default priority for the license category (optional; may be included in the response).

Response Codes:

Code

Description

200

OK — Custom license created successfully.

400

Bad request — License name already exists, or validation failed (for example, name or alias exceeds maximum length of 128 characters).

403

Permission denied — User does not have Admin permission.

415

Unsupported media type — Failed to parse request body (invalid JSON format).

500

Internal server error — Failed to create custom license due to server error.

Example Request Body:

{
  "name": "MyCustomLicense",
  "full_name": "My Custom License Full Name",
  "text": "This is a custom license description",
  "references": [
    "https://example.com/license",
    "https://example.com/legal"
  ],
  "aliases": [
    "MCL",
    "MyLicense"
  ],
  "category": "Permissive"
}

Example Successful Response (200 OK):

{
  "name": "MyCustomLicense",
  "full_name": "My Custom License Full Name",
  "text": "This is a custom license description",
  "references": [
    "https://example.com/license",
    "https://example.com/legal"
  ],
  "aliases": [
    "MCL",
    "MyLicense"
  ],
  "category": "Permissive",
  "isCustom": true
}

Sample Request:

POST /api/v1/licensesNames/customLicense
Content-Type: application/json
Accept: application/json
curl -u <user>:<password> \
  -X POST "https://<xray-host>/xray/api/v1/licensesNames/customLicense" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "name": "MyCustomLicense",
    "full_name": "My Custom License Full Name",
    "text": "This is a custom license description",
    "references": [
      "https://example.com/license",
      "https://example.com/legal"
    ],
    "aliases": [
      "MCL",
      "MyLicense"
    ],
    "category": "Permissive"
  }'

Sample Error Responses:

400 Bad Request - License Already Exists
{
  "error": "License name already exists"
}

400 Bad Request - Validation Failed
{
  "error": "license name 'VeryLongLicenseNameThatExceedsTheMaximumAllowedLengthOfOneHundredAndTwentyEightCharacters' is longer than max length allowed (128)"
}

415 Unsupported Media Type
{
  "error": "Failed to parse message"
}

500 Internal Server Error
{
  "error": "Failed to set custom license"
}