Import Packages from External Sources¶
Use Repod's import feature to bring packages from public or internal repositories into your private repository without uploading files manually. This guide uses the API, so you can script it. Everything here is also available in the web interface (Sources and Importer); see the Sources and synchronisation tutorial for the screen-by-screen version.
Maven, PyPI, npm, and container images have their own importer
This guide covers the APT, RPM and APK source-and-catalog workflow. Maven Central, PyPI, npmjs.org, and Docker Hub each have a simpler, one-shot Importer tab (search or reference an artifact by coordinates, it's downloaded, scanned, and published in a single step) — see Client setup and Container registry for those.
How importing works¶
Importing is a two-step process:
-
Sync the index — Repod fetches the remote repository's package metadata (
Packages.gzfor APT,repomd.xmlfor RPM,APKINDEXfor Alpine) and stores it in a searchable local catalog. No packages are downloaded at this stage. -
Import a package — Repod downloads the selected package from the remote source, runs it through the full security pipeline (antivirus, CVE scan, dependencies), and publishes it to your distribution.
There are two kinds of sources:
- Built-in sources — Ubuntu, Debian, AlmaLinux, Rocky, Alpine and others, switched on or off in Administration → Paramètres, section Sources de paquets.
- Custom sources — an APT or RPM repository that you add yourself (for example Docker CE). Adding one requires the admin role.
Roles¶
| Action | Minimum role |
|---|---|
| Read the sources, search the catalog | any signed-in user |
| Sync an index | maintainer |
| Import a package | uploader |
| Add, enable or remove a custom source | admin |
Prepare a token¶
All calls below need a token. For a quick test, log in; for automation, use an
API token (repod_…) created for a service account, see
Set up CI/CD publishing.
API=http://localhost:8000/api/v1
TOKEN=$(curl -s -X POST "$API/auth/token" \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"YourPassword1!"}' | jq -r .access_token)
A login token expires after 60 minutes.
Step 1 — See the sources¶
{
"source_id": "ubuntu-jammy",
"label": "Ubuntu 22.04 (Jammy) main",
"last_sync": "2026-10-14T12:04:01.424376+00:00",
"pkg_count": 6090,
"status": "ok",
"error": null,
"security": false,
"format": "apt"
}
There is one entry per source (APT, RPM and APK together). pkg_count is the
number of packages in the local catalog, status tells whether the last sync
worked, and error explains why when it did not.
The custom sources you added are listed separately:
Step 2 — Add a custom source (admin)¶
Optionally ask Repod which components a repository offers, and check the signing key before you trust it:
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/custom-sources/discover-components" \
-d '{"base_url": "https://download.docker.com/linux/ubuntu", "codename": "jammy"}'
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/custom-sources/preview-key" \
-d '{"gpg_key_url": "https://download.docker.com/linux/ubuntu/gpg"}'
Then create the source:
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/custom-sources" \
-d '{
"id": "docker-ubuntu",
"label": "Docker CE",
"base_url": "https://download.docker.com/linux/ubuntu",
"codename": "jammy",
"components": ["stable"],
"archs": ["amd64"],
"target_distribution": "jammy",
"gpg_key_url": "https://download.docker.com/linux/ubuntu/gpg"
}'
The answer is 201 with the source, including the key_fingerprints of
the signing key. Compare them with the ones published by the vendor.
target_distribution is the Repod distribution that imported packages go
into.
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/custom-rpm-sources" \
-d '{
"id": "epel9",
"label": "EPEL 9",
"repo_url": "https://dl.fedoraproject.org/pub/epel/9/Everything/x86_64/",
"arch": "x86_64",
"target_distribution": "almalinux9"
}'
POST /import/custom-rpm-sources/discover-metadata with
{"repo_url": "…"} and POST /import/custom-rpm-sources/preview-key
help you check the repository and its key first.
To switch a source off without deleting it, send PATCH
/import/custom-sources/{id} (or /import/custom-rpm-sources/{id}) with
{"enabled": false}. DELETE on the same path removes it and answers 204.
Step 3 — Sync the index¶
Syncing fetches the remote metadata and fills the local catalog. It does not download any package.
The answer gives the job to follow:
If a sync of the same scope is already running, already_running is true
and you get that job back instead of a second one.
Follow the job by polling its state, or stream its log:
curl -s -H "Authorization: Bearer $TOKEN" "$API/import/sync/jobs/$JOB_ID" | jq .
# Server-Sent Events; add ?from_index=N to resume after a disconnection
curl -N -H "Authorization: Bearer $TOKEN" "$API/import/sync/jobs/$JOB_ID/stream"
The job reports status, total, done_count and error_count.
POST /import/sync/jobs/{job_id}/cancel stops it: the source being downloaded
finishes, the next ones are skipped.
A custom source can also be synced on its own. The call waits for the end and returns the result of each repository:
Sync duration
A large source (for example Ubuntu jammy universe, about 59 000 packages)
takes noticeably longer than a small one. Run it in the background and
follow the job rather than waiting on the command.
Step 4 — Search the catalog¶
The search reads the local catalog, so it works without internet access.
curl -s -H "Authorization: Bearer $TOKEN" \
"$API/import/search?q=nginx&distro=jammy&limit=5" | jq '.results[0]'
{
"name": "nginx",
"version": "1.18.0-6ubuntu14.18",
"arch": "amd64",
"section": "web",
"description": "small, powerful, scalable web/proxy server",
"size": 3884,
"sha256": "75de46a02a15d7ced7bb61619c704ad235e0bd513badc968045887a041762136",
"distro": "jammy-updates",
"source_id": "ubuntu-jammy-updates",
"synced_at": "2026-08-08T04:56:21.062710+00:00",
"security": false,
"format": "deb"
}
(The real answer also carries the depends field; it is left out here.)
The optional filters are source_id, format (deb, rpm or apk),
distro and arch. A search can take a few seconds the first time on a large
catalog. If the catalog is empty, the call answers 424 with a message asking
you to run a sync first.
To see what a package needs before you import it:
It lists the dependencies and tells which ones are already in your repository.
Step 5 — Import a package¶
curl -N -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/fetch" \
-d '{
"package": "nginx",
"distribution": "jammy",
"version": "1.18.0-6ubuntu14.18",
"arch": "amd64"
}'
Only package is required. Without version, the latest version of the
catalog is used; without distribution, it is deduced from the source;
without arch, amd64 or x86_64 is preferred. group names the import
group the package belongs to (default: the package name).
The answer is a stream of Server-Sent Events, one line per step, in the
form data: <level>|<message>. The last line is data: done|DONE.
The package and its missing dependencies each go through the full
pipeline.
curl -N -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/batch" \
-d '{"packages": ["nginx", "curl", "libssl3"], "distribution": "jammy"}'
Up to 50 packages per call, one after the other, on the same stream.
curl -s -X POST -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
"$API/import/bulk" \
-d '{"items": [
{"package": "nginx", "distribution": "jammy"},
{"package": "curl", "distribution": "jammy"}
]}'
The call answers at once with a bulk_id and one job per package. Up to
50 items, three validations at a time. Follow it with:
curl -s -H "Authorization: Bearer $TOKEN" "$API/import/bulk/$BULK_ID" | jq '.jobs[] | {package, status}'
A job is pending, running, success, error, cve_blocked,
pending_review or cancelled. The state is kept for two hours.
POST /import/bulk/{bulk_id}/cancel cancels the jobs that have not started.
Prefer the background list for long lists
A streamed import ties up one connection for the whole duration. The background list returns immediately and does not depend on a proxy timeout.
What can happen to an imported package¶
| Outcome | Meaning |
|---|---|
success |
The package passed every check and is published |
pending_review |
A CVE matched the review policy. It waits for a decision in Sécurité → Décisions CVE |
cve_blocked |
A CVE matched the block policy and the package was refused |
error |
The download or a check failed; read the log of the job |
Air-gapped environments¶
Where Repod cannot reach external URLs, download the packages elsewhere and upload them through the standard upload endpoint:
Troubleshooting¶
Search answers 424¶
The local catalog is empty. Run a sync (Step 3), then search again.
A sync ends with status: error¶
Read the error field of the source:
curl -s -H "Authorization: Bearer $TOKEN" "$API/import/sync-status" \
| jq '.sources[] | select(.status != "ok") | {source_id, status, error}'
For APT, the remote Release file cannot be fetched: check the URL, the
network access and whether the source requires authentication. For RPM, the
repodata/repomd.xml is unreachable. The server log gives more detail:
Run the sync again once the connection works.
An import fails because the package cannot be found¶
The version in the catalog no longer exists on the remote server (removed upstream). Sync the index again and pick a current version.
A package is stuck in pending_review¶
The CVE scan found a vulnerability that matches the review policy. Open
Sécurité → Décisions CVE, read the findings, and approve or reject (see
Walk through a CVE remediation).
The call answers 404 for a distribution¶
If the distribution has access restrictions that you are not part of, Repod answers as if it did not exist.
Scheduled synchronization¶
To keep the index fresh, set a schedule in Administration → Paramètres, section Synchronisation automatique (see Keep your data fresh), or call the API from a scheduler:
# Sync all enabled sources daily at 02:00
0 2 * * * curl -sf -X POST \
-H "Authorization: Bearer $REPOD_TOKEN" \
http://localhost:8000/api/v1/import/sync/start >> /var/log/repod-sync.log 2>&1
Use an API token created for a service account with the maintainer role
(a sync needs at least that role).