Use cURL integration with Artifactory
The jf rt curl command runs cURL against Artifactory using the server and credentials you already configured in the JFrog CLI, so you do not pass URLs or auth headers manually. You need the curl executable on your PATH. Use this page to prepare your environment, understand options, and follow copy-pastable examples for common REST calls.
Command syntax
jf rt curl <api-path> [--server-id=<server-id>]Where:
<api-path>— Artifactory REST path only (no host), for example/api/system/pingor/api/build.- After the path, pass the same flags you would pass to
curl(method, headers, body, and so on), except the full Artifactory URL and login credentials (the CLI adds those). <server-id>— Optional. Configured server ID fromjf c add. If--server-idis omitted, the default configured server is used.
Example:
jf rt curl /api/system/pingPrerequisites
To prepare for using jf rt curl:
- JFrog CLI is installed — verify with
jf --version - curl is in your PATH — verify with
curl --version - At least one Artifactory server is configured — run
jf c addto add a server, thenjf config showto confirm. See Configuring the CLI for full setup instructions.
Note
This command supports only Artifactory REST APIs, which are accessible under
https://<JFrog base URL>/artifactory/api/.
Note
jf rt curlalways returns exit code0, regardless of the HTTP response status. A401,403, or5xxresponse will still produce a zero exit code. To detect failures in scripts, parse the JSON response body or use-w '%{http_code}'to inspect the HTTP status code.
Note
By default, curl prints a progress meter to stdout alongside the response body. Add the
-s(silent) flag to suppress it:jf rt curl -s -XGET /api/system/ping.
Commands Params
| Parameter | Command / Description |
|---|---|
| Command name | rt curl |
| Abbreviation | rt cl |
Command Options
| Option | Description |
|---|---|
--server-id | [Optional] Server ID configured using the jf c add command. If not specified, the default configured server is used. |
Environment Variables
| Variable | Description |
|---|---|
JFROG_CLI_SERVER_ID | [Optional] Server ID to use as an alternative to --server-id. The --server-id flag takes priority if both are set. |
Command Arguments
| Argument | Description |
|---|---|
| cURL arguments and flags | The same list of arguments and flags passed to cURL, except for the following changes: (1) The full Artifactory URL should not be passed. Instead, the REST endpoint URI should be sent. (2) The login credentials should not be passed. Instead, the --server-id should be used. |
Supported cURL Options
| Option | Description | Example |
|---|---|---|
-X | HTTP method (non-GET) | -X POST, -X PUT, -X DELETE — omit for GET requests (curl infers GET by default) |
-H | Add HTTP header | -H "Content-Type: application/json" |
-d | Send request data/body | -d '{"key":"value"}' |
-v | Verbose output | Shows detailed request/response |
-s | Silent mode | Suppress progress meter |
-o | Output to file | -o response.json |
-i | Include headers | Include response headers in output |
Authentication
To authenticate jf rt curl requests:
Servers can be configured with any of the following authentication methods:
- Username and Password
- Access Token
- API Key
To verify which authentication method is configured for a server, run jf config show.
If you receive a Token failed verification error, your access token may have expired. To update credentials, re-run jf c add with the same server ID, or generate a new token in the JFrog Platform UI under User Management > Access Tokens.
cURL Integration Examples
Example 1: Send a GET Request to the Default Server
To send a GET request to the /api/build endpoint on the default server:
- Run:
jf rt curl /api/build- Inspect the JSON response (see expected output below).
Expected response:
{
"builds": [...]
}Example 2: Send a GET Request to a Specific Server
To send a GET request to /api/build on a specific configured server:
- Run:
jf rt curl /api/build --server-id my-rt-server- Inspect the JSON response.
Expected response:
{
"builds": [...]
}Example 3: Create a Repository with PUT
To create a new local repository with PUT /api/repositories/<repo-key>:
- Run (replace
my-repowith your repository key):
jf rt curl -XPUT -H "Content-Type: application/json" \
-d '{"key":"my-repo","rclass":"local","packageType":"generic"}' \
/api/repositories/my-repo- Confirm the success message in the output.
To update an existing repository's configuration, use POST /api/repositories/<repo-key> instead of PUT.
Expected response:
Successfully created repository 'my-repo'
Example 4: Ping the Artifactory Server
To verify that the Artifactory REST API responds:
Note
jf rt curlalways injects your stored credentials. If your credentials are expired or invalid, this endpoint returns401— which indicates an authentication failure, not a connectivity problem. To perform a pure connectivity check without authentication, usejf rt pinginstead.
- Run:
jf rt curl -s /api/system/ping- Confirm the response body is
OK.
The -s flag suppresses the curl progress meter so the response body appears cleanly. Without -s, the progress meter is printed to stdout and the OK response is concatenated onto its last line, which breaks output parsing.
Expected response:
OK
Example 5: Get System Version
To retrieve Artifactory version information:
- Run:
jf rt curl /api/system/version- Parse or read the returned JSON.
Expected response:
{
"version": "7.x.x",
"revision": "...",
"addons": [...],
"license": "..."
}Note
The actual response may include additional fields such as
servicesVersionsandentitlementsdepending on your Artifactory version and configuration.
Example 6: Use Verbose Mode for Debugging
To run a request with verbose cURL output (for debugging):
Security warning
Verbose mode prints your full Bearer token in plaintext in the
authorization:request header line. Do not share terminal output, screenshots, or CI logs captured with-v— doing so will expose your live access token. If you have already shared verbose output, revoke and rotate the token immediately in the JFrog Platform UI under User Management > Access Tokens.
Note
When using
-vwith GET requests, omit-XGETsince curl infers GET as the default method. Explicitly passing-XGETcauses curl to print:"Note: Unnecessary use of -X or --request, GET is already inferred."
- Run:
jf rt curl -v /api/system/version- Review the verbose trace (do not share logs that include the
authorizationheader).
Expected output includes:
* Connected to <your-instance>.jfrog.io port 443
* using HTTP/2
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [authorization: Bearer eyJ... (full token printed here)]
< HTTP/2 200
{"version":"7.x.x","revision":"...","addons":[...],"license":"..."}
Note
The
authorizationheader format depends on how your server was configured:Bearer <token>for access token authentication, orBasic <base64>for username and password. If you configured the server with--basic-auth-only, you will seeBasichere.
Example 7: Delete a Repository
To delete a repository with the REST API:
Warning
This operation permanently deletes the repository and all of its contents. It cannot be undone. Only run this against a test or temporary repository.
Prerequisite
The repository must already exist. You can create a test repository using Example 3 (replace
my-repowithmy-temp-repoin that example), or substitutemy-temp-repobelow with an existing repository key.
- Run (use a disposable repository key):
jf rt curl -XDELETE /api/repositories/my-temp-repo- Confirm the deletion message in the output.
Expected response:
Repository 'my-temp-repo' and all its content have been removed successfully.
Example 8: Use Environment Variable for Server Selection
To select the server with JFROG_CLI_SERVER_ID instead of --server-id:
- Set the variable and run the request:
export JFROG_CLI_SERVER_ID=my-rt-server
jf rt curl /api/build- Inspect the JSON response.
Expected response:
{
"builds": [...]
}Example 9: Reload Plugins
To reload Artifactory plugins (admin, self-hosted only):
Note
Plugin management via the REST API is only available for self-hosted Artifactory installations. This endpoint is not available on JFrog SaaS. On SaaS instances, the server returns HTTP
403with"Function is not supported when running on the cloud". The CLI will still exit with code0in both cases.
- Run:
jf rt curl -XPOST /api/plugins/reload- Confirm the success message on self-hosted instances.
Expected response (self-hosted only):
Plugins have been successfully reloaded.
Example 10: Upload a File with PUT
To upload a local file using PUT and -d @:
- Run (replace paths and repository with your values):
jf rt curl -XPUT -d @/path/to/local/file.txt /my-repo/path/to/file.txt- Confirm HTTP
201and the JSON summary in the output.
Prerequisite
The repository
my-repomust exist. See Example 3 to create it.
Expected response (HTTP 201):
{
"repo": "my-repo",
"path": "/path/to/file.txt",
"created": "...",
"createdBy": "<username>",
"downloadUri": "https://<your-instance>.jfrog.io/artifactory/my-repo/path/to/file.txt",
"mimeType": "text/plain",
"size": "<bytes>",
"checksums": {
"sha1": "...",
"md5": "...",
"sha256": "..."
},
"originalChecksums": {
"sha256": "..."
},
"uri": "https://<your-instance>.jfrog.io/artifactory/my-repo/path/to/file.txt"
}Common Errors
To diagnose a failed jf rt curl request, match your symptom to this table:
| Error | Cause | Resolution |
|---|---|---|
{"status":401,"message":"Token failed verification: parse"} | Access token is expired or malformed | Re-run jf c add to update credentials, or generate a new token in the JFrog Platform UI |
{"status":403,...} | Authenticated but insufficient permissions | Use an admin token, or request the required permissions from your Artifactory administrator |
{"status":404,...} | Repository or path does not exist | Verify the repository key and path; create the repository first if needed (see Example 3) |
{"status":403,"message":"Function is not supported when running on the cloud"} on /api/plugins/reload | Endpoint not available on JFrog SaaS | This feature is self-hosted only; see Example 9 |
| Progress meter printed before response body | curl default behavior | Add -s to suppress: jf rt curl -s -XGET /api/system/ping |
Note: Unnecessary use of -X or --request | -XGET is redundant; curl infers GET by default | Drop -XGET for GET requests; use -X only for POST, PUT, DELETE |
Updated about 1 month ago
