Artifact lookup API
Reference for resolving existing package artifact IDs from repository-scoped coordinates or exact file attributes.
GET
/api/artifacts/search/
Purpose
- resolve an existing
artifact_idbefore follow-up API calls - keep lookups deterministic by combining one repository with exactly one lookup mode
- return only artifacts visible to the authenticated caller
Request
Query parameters
Always send repository.
Then choose exactly one lookup mode:
Package coordinates
- Maven:
format=mavenwithname, optionalgroup_id, optionalversion - Python, npm, Go:
formatwithname, optionalversion
Use this when you know the package coordinates and want the matching artifact ID directly.
Path or filename
pathfilename
Use one of them or both when your automation knows the stored repository path and file name.
Digest
digest
Use this when you already have the stored checksum or content digest string for the package artifact.
Validation rules:
repositoryis requiredgroup_idonly works withformat=mavenversiononly works together withname- combine
repositorywith exactly one lookup mode limitdefaults to20and cannot exceed100offsetdefaults to0
| Name | Required | Type |
|---|---|---|
repository |
Required | string |
format |
Optional | string · enum: maven, python, npm, go |
group_id |
Optional | string |
name |
Optional | string |
version |
Optional | string |
path |
Optional | string |
filename |
Optional | string |
digest |
Optional | string |
limit |
Optional | integer |
offset |
Optional | integer |
Responses
Common status codes:
200 OK: matching visible artifacts were resolved, or the result set is empty.400 Bad Request: the query is missingrepository, mixes lookup modes, or uses unsupported parameters.401 Unauthorized: no valid programmatic credentials were provided.
200
OK
Resolved artifact matches visible to the authenticated caller.
When no visible artifact matches the lookup, the response still
succeeds with an empty
results array.results
Required
array
Visible artifacts that matched the requested lookup mode.
total
Required
integer
Total number of matches before pagination.
limit
Required
integer
Effective result limit applied to the response.
offset
Required
integer
Effective result offset applied to the response.
{
"results": [
{
"artifact_id": "4fd75091-2d3a-48b7-9e35-85a5edfa1d92",
"repository": "libs-release",
"format": "maven",
"name": "demo",
"group_id": "com.example",
"version": "1.2.3",
"path": "com/example/demo/1.2.3",
"filename": "demo-1.2.3.jar"
}
],
"total": 1,
"limit": 20,
"offset": 0
}
400
Bad Request
Bad request. Typical causes include:
repositoryis missing.formatis unsupported.group_idwas provided outside Maven mode.- no lookup mode was selected.
- multiple lookup modes were combined in one request.
limitoroffsetis invalid.
error
Required
string
Human-readable error message for the rejected upload.
{
"error": "combine repository with exactly one lookup mode"
}
401
Unauthorized
Authentication failed or no programmatic credentials were provided.
error
Required
string
Human-readable error message for the rejected upload.
{
"error": "authentication required"
}
Examples
curl \
-H "Authorization: Bearer $CRAFTIFACT_TOKEN" \
"https://packages.example.com/api/artifacts/search/?repository=libs-release&format=maven&group_id=com.example&name=demo&version=1.2.3"
curl \
-H "Authorization: Bearer $CRAFTIFACT_TOKEN" \
"https://packages.example.com/api/artifacts/search/?repository=libs-release&path=com/example/demo/1.2.3&filename=demo-1.2.3.jar"
Related pages
- To bind an SBOM after resolving the artifact ID, see SBOM upload API.
- For practical upload workflows, see Generate SBOMs with client tools.