Use this API to interact with the Cargo package registry, including its sparse index, registry configuration, and crate downloads. Generally these endpoints are used by Cargo itself and are not meant for manual consumption. For more information, see the package registry.
Get the sparse index for a Cargo crate (1-character name)
GET /api/v4/projects/{id}/packages/cargo/1/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
package_Path, | String | Name of the Cargo package |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get the sparse index for a Cargo crate (2-character name)
GET /api/v4/projects/{id}/packages/cargo/2/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
package_Path, | String | Name of the Cargo package |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get the sparse index for a Cargo crate (3-character name)
GET /api/v4/projects/{id}/packages/cargo/3/{first_char}/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
first_Path, | String | First character of the Cargo package name |
package_Path, | String | Name of the Cargo package |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Publish a Cargo crate
PUT /api/v4/projects/{id}/packages/cargo/api/v1/crates/new
Receives the cargo publish body and extracts the crate asynchronously
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
Request body (multipart/form-data)
| Property | Type | Description |
|---|---|---|
fileRequired | String (binary) | The cargo publish body, |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get config.json
GET /api/v4/projects/{id}/packages/cargo/config.json
This will be used by cargo for further requests
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Download a Cargo crate
GET /api/v4/projects/{id}/packages/cargo/{package_name}/{package_version}/download
This endpoint serves the .crate file for a given package name and version
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
package_Path, | String | Name of the Cargo package |
package_Path, | String | Version of the Cargo package |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |
Get the sparse index for a Cargo crate (4+ character name)
GET /api/v4/projects/{id}/packages/cargo/{prefix_1}/{prefix_2}/{package_name}
Returns newline-delimited JSON, one line per published version, most recently published first. Limited to the 500 most recently published versions.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String or integer | ID or URL- |
prefix_Path, | String | First two characters of the Cargo package name |
prefix_Path, | String | Next two characters of the Cargo package name |
package_Path, | String | Name of the Cargo package |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (text/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not Found | — |