{"openapi":"3.1.0","info":{"title":"crates.io","description":"\n__Experimental API documentation for the [crates.io](https://crates.io/)\npackage registry.__\n\nThis document describes the API used by the crates.io website, cargo\nclient, and other third-party tools to interact with the crates.io\nregistry.\n\nBefore using this API, please read the\n[crates.io data access policy](https://crates.io/data-access) and ensure\nthat your use of the API complies with the policy.\n\n__The API is under active development and may change at any time__,\nthough we will try to avoid breaking changes where possible.\n\nSome parts of the API follow the \"Registry Web API\" spec documented\nat <https://doc.rust-lang.org/cargo/reference/registry-web-api.html>\nand can be considered stable.\n\nMost parts of the API do not require authentication. The endpoints\nthat do require authentication are marked as such in the documentation,\nwith some requiring cookie authentication (usable only by the web UI)\nand others requiring API token authentication (usable by cargo and\nother clients).\n","termsOfService":"https://crates.io/policies","contact":{"name":"the crates.io team","email":"help@crates.io"},"license":{"name":"MIT OR Apache-2.0","url":"https://github.com/rust-lang/crates.io/blob/main/README.md#%EF%B8%8F-license"},"version":"0.0.0"},"servers":[{"url":"https://crates.io"},{"url":"https://staging.crates.io"}],"paths":{"/api/private/crate_owner_invitations":{"get":{"tags":["owners"],"summary":"List all crate owner invitations for a crate or user.","operationId":"list_crate_owner_invitations","parameters":[{"name":"crate_name","in":"query","description":"Filter crate owner invitations by crate name.\n\nOnly crate owners can query pending invitations for their crate.","required":false,"schema":{"type":"string"}},{"name":"invitee_id","in":"query","description":"The ID of the user who was invited to be a crate owner.\n\nThis parameter needs to match the authenticated user's ID.","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["invitations","users","meta"],"properties":{"invitations":{"type":"array","items":{"$ref":"#/components/schemas/CrateOwnerInvitation"},"description":"The list of crate owner invitations."},"meta":{"type":"object","properties":{"next_page":{"type":["string","null"],"description":"Query parameter string to fetch the next page of results.","example":"?seek=c0ffee"}}},"users":{"type":"array","items":{"$ref":"#/components/schemas/User"},"description":"The list of users referenced in the crate owner invitations."}}}}}}},"security":[{"cookie":[]}]}},"/api/private/session":{"delete":{"tags":["session"],"summary":"End the current session.","operationId":"end_session","responses":{"200":{"description":"Successful Response"}},"security":[{"cookie":[]}]}},"/api/private/session/authorize":{"get":{"tags":["session"],"summary":"Complete authentication flow.","description":"This route is called from the GitHub API OAuth flow after the user accepted or rejected\nthe data access permissions. It will check the `state` parameter and then call the GitHub API\nto exchange the temporary `code` for an API token. The API token is returned together with\nthe corresponding user information.\n\nsee <https://developer.github.com/v3/oauth/#github-redirects-back-to-your-site>\n\n## Query Parameters\n\n- `code` – temporary code received from the GitHub API **(Required)**\n- `state` – state parameter received from the GitHub API **(Required)**","operationId":"authorize_session","parameters":[{"name":"code","in":"query","description":"Temporary code received from the GitHub API.","required":true,"schema":{"type":"string"},"example":"901dd10e07c7e9fa1cd5"},{"name":"state","in":"query","description":"State parameter received from the GitHub API.","required":true,"schema":{"type":"string"},"example":"fYcUY3FMdUUz00FC7vLT7A"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["user","owned_crates"],"properties":{"owned_crates":{"type":"array","items":{"type":"object","required":["id","name","email_notifications"],"properties":{"email_notifications":{"type":"boolean","deprecated":true},"id":{"type":"integer","format":"int32","description":"The opaque identifier of the crate.","example":123},"name":{"type":"string","description":"The name of the crate.","example":"serde"}}},"description":"The crates that the authenticated user owns."},"user":{"$ref":"#/components/schemas/AuthenticatedUser","description":"The authenticated user."}}}}}}}}},"/api/private/session/begin":{"get":{"tags":["session"],"summary":"Begin authentication flow.","description":"This route will return an authorization URL for the GitHub OAuth flow including the crates.io\n`client_id` and a randomly generated `state` secret.\n\nsee <https://developer.github.com/v3/oauth/#redirect-users-to-request-github-access>","operationId":"begin_session","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["url","state"],"properties":{"state":{"type":"string","example":"b84a63c4ea3fcb4ac84"},"url":{"type":"string","example":"https://github.com/login/oauth/authorize?client_id=...&state=...&scope=read%3Aorg"}}}}}}}}},"/api/v1/categories":{"get":{"tags":["categories"],"summary":"List all categories.","operationId":"list_categories","parameters":[{"name":"sort","in":"query","description":"The sort order of the categories.\n\nValid values: `alpha`, and `crates`.\n\nDefaults to `alpha`.","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["categories","meta"],"properties":{"categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"The list of categories."},"meta":{"type":"object","required":["total"],"properties":{"total":{"type":"integer","format":"int64","description":"The total number of categories.","example":123}}}}}}}}}}},"/api/v1/categories/{category}":{"get":{"tags":["categories"],"summary":"Get category metadata.","operationId":"find_category","parameters":[{"name":"category","in":"path","description":"Name of the category","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["category"],"properties":{"category":{"$ref":"#/components/schemas/Category"}}}}}}}}},"/api/v1/category_slugs":{"get":{"tags":["categories"],"summary":"List all available category slugs.","operationId":"list_category_slugs","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["category_slugs"],"properties":{"category_slugs":{"type":"array","items":{"$ref":"#/components/schemas/Slug"},"description":"The list of category slugs."}}}}}}}}},"/api/v1/confirm/{email_token}":{"put":{"tags":["users"],"summary":"Marks the email belonging to the given token as verified.","operationId":"confirm_user_email","parameters":[{"name":"email_token","in":"path","description":"Secret verification token sent to the user's email address","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}}}},"/api/v1/crates":{"get":{"tags":["crates"],"summary":"Returns a list of crates.","description":"Called in a variety of scenarios in the front end, including:\n- Alphabetical listing of crates\n- List of crates under a specific owner\n- Listing a user's followed crates","operationId":"list_crates","parameters":[{"name":"sort","in":"query","description":"The sort order of the crates.\n\nValid values: `alphabetical`, `relevance`, `downloads`,\n`recent-downloads`, `recent-updates`, `new`.\n\nDefaults to `relevance` if `q` is set, otherwise `alphabetical`.","required":false,"schema":{"type":"string"}},{"name":"q","in":"query","description":"A search query string.","required":false,"schema":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}},{"name":"include_yanked","in":"query","description":"Set to `yes` to include yanked crates.","required":false,"schema":{"type":"string"},"example":"yes"},{"name":"category","in":"query","description":"If set, only return crates that belong to this category, or one\nof its subcategories.","required":false,"schema":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}},{"name":"all_keywords","in":"query","description":"If set, only return crates matching all the given keywords.\n\nThis parameter expects a space-separated list of keywords.","required":false,"schema":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}},{"name":"keyword","in":"query","description":"If set, only return crates matching the given keyword\n(ignored if `all_keywords` is set).","required":false,"schema":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}},{"name":"letter","in":"query","description":"If set, only return crates with names that start with the given letter\n(ignored if `all_keywords` or `keyword` are set).","required":false,"schema":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}},{"name":"user_id","in":"query","description":"If set, only crates owned by the given crates.io user ID are returned\n(ignored if `all_keywords`, `keyword`, or `letter` are set).","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"team_id","in":"query","description":"If set, only crates owned by the given crates.io team ID are returned\n(ignored if `all_keywords`, `keyword`, `letter`, or `user_id` are set).","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"following","in":"query","description":"If set, only crates owned by users the current user follows are returned\n(ignored if `all_keywords`, `keyword`, `letter`, `user_id`,\nor `team_id` are set).\n\nThe exact value of this parameter is ignored, but it must not be empty.","required":false,"schema":{"type":"string"},"example":"yes"},{"name":"ids[]","in":"query","description":"If set, only crates with the specified names are returned (ignored\nif `all_keywords`, `keyword`, `letter`, `user_id`, `team_id`,\nor `following` are set).","required":false,"schema":{"type":"array","items":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crates","meta"],"properties":{"crates":{"type":"array","items":{"$ref":"#/components/schemas/Crate"}},"meta":{"type":"object","required":["total"],"properties":{"next_page":{"type":["string","null"],"description":"Query string to the next page of results, if any.","example":"?page=3"},"prev_page":{"type":["string","null"],"description":"Query string to the previous page of results, if any.","example":"?page=1"},"total":{"type":"integer","format":"int64","description":"The total number of crates that match the query.","example":123}}}}}}}}},"security":[{},{"api_token":[]},{"cookie":[]}]}},"/api/v1/crates/new":{"get":{"tags":["crates"],"summary":"Get crate metadata (for the `new` crate).","description":"This endpoint works around a small limitation in `axum` and is delegating\nto the `GET /api/v1/crates/{name}` endpoint internally.","operationId":"find_new_crate","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate"],"properties":{"categories":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Category"},"description":"The categories of the crate.","example":null},"crate":{"$ref":"#/components/schemas/Crate","description":"The crate metadata."},"keywords":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Keyword"},"description":"The keywords of the crate.","example":null},"versions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Version"},"description":"The versions of the crate.","example":null}}}}}}}},"put":{"tags":["publish"],"summary":"Publish a new crate/version.","description":"Used by `cargo publish` to publish a new crate or to publish a new version of an\nexisting crate.","operationId":"publish","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate","warnings"],"properties":{"crate":{"$ref":"#/components/schemas/Crate"},"warnings":{"$ref":"#/components/schemas/PublishWarnings"}}}}}}},"security":[{"api_token":[]},{"trustpub_token":[]},{"cookie":[]}]}},"/api/v1/crates/{name}":{"get":{"tags":["crates"],"summary":"Get crate metadata.","operationId":"find_crate","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Additional data to include in the response.\n\nValid values: `versions`, `keywords`, `categories`, `badges`,\n`downloads`, `default_version`, or `full`.\n\nDefaults to `full` for backwards compatibility.\n\n**Note**: `versions` and `default_version` share the same key `versions`, therefore `default_version` will be ignored if both are provided.\n\nThis parameter expects a comma-separated list of values.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate"],"properties":{"categories":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Category"},"description":"The categories of the crate.","example":null},"crate":{"$ref":"#/components/schemas/Crate","description":"The crate metadata."},"keywords":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Keyword"},"description":"The keywords of the crate.","example":null},"versions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Version"},"description":"The versions of the crate.","example":null}}}}}}}},"delete":{"tags":["crates"],"summary":"Delete a crate.","description":"The crate is immediately deleted from the database, and with a small delay\nfrom the git and sparse index, and the crate file storage.\n\nThe crate can only be deleted by the owner of the crate, and only if the\ncrate has been published for less than 72 hours, or if the crate has a\nsingle owner, has been downloaded less than 1000 times for each month it has\nbeen published, and is not depended upon by any other crate on crates.io.","operationId":"delete_crate","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"message","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successful Response"}},"security":[{"cookie":[]}]},"patch":{"tags":["crates"],"summary":"Update crate settings.","operationId":"update_crate","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["crate"],"properties":{"crate":{"oneOf":[{"type":"object","properties":{"trustpub_only":{"type":["boolean","null"],"description":"Whether this crate can only be published via Trusted Publishing."}}}],"description":"The crate settings to update."}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate"],"properties":{"crate":{"$ref":"#/components/schemas/Crate","description":"The updated crate metadata."}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/crates/{name}/downloads":{"get":{"tags":["crates"],"summary":"Get the download counts for a crate.","description":"This includes the per-day downloads for the last 90 days and for the\nlatest 5 versions plus the sum of the rest.","operationId":"get_crate_downloads","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Additional data to include in the response.\n\nValid values: `versions`.\n\nDefaults to no additional data.\n\nThis parameter expects a comma-separated list of values.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["version_downloads","meta"],"properties":{"meta":{"type":"object","required":["extra_downloads"],"properties":{"extra_downloads":{"type":"array","items":{"type":"object","required":["date","downloads"],"properties":{"date":{"type":"string","description":"The date this download count is for.","example":"2019-12-13"},"downloads":{"type":"integer","format":"int64","description":"The number of downloads on the given date.","example":123}}}}}},"version_downloads":{"type":"array","items":{"$ref":"#/components/schemas/VersionDownload"},"description":"The per-day download counts for the last 90 days."},"versions":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Version"},"description":"The versions referenced in the download counts, if `?include=versions`\nwas requested."}}}}}}}}},"/api/v1/crates/{name}/follow":{"put":{"tags":["crates"],"summary":"Follow a crate.","operationId":"follow_crate","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]},"delete":{"tags":["crates"],"summary":"Unfollow a crate.","operationId":"unfollow_crate","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/crates/{name}/following":{"get":{"tags":["crates"],"summary":"Check if a crate is followed.","operationId":"get_following_crate","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["following"],"properties":{"following":{"type":"boolean","description":"Whether the authenticated user is following the crate."}}}}}}},"security":[{"cookie":[]}]}},"/api/v1/crates/{name}/owner_team":{"get":{"tags":["owners"],"summary":"List team owners of a crate.","operationId":"get_team_owners","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["teams"],"properties":{"teams":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}}}}}}}}}},"/api/v1/crates/{name}/owner_user":{"get":{"tags":["owners"],"summary":"List user owners of a crate.","operationId":"get_user_owners","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["users"],"properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}}}}}}}}}},"/api/v1/crates/{name}/owners":{"get":{"tags":["owners"],"summary":"List crate owners.","operationId":"list_owners","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["users"],"properties":{"users":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}}}}}}}}},"put":{"tags":["owners"],"summary":"Add crate owners.","operationId":"add_owners","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["owners"],"properties":{"owners":{"type":"array","items":{"type":"string"},"description":"List of owner login names to add or remove.\n\nFor users, use just the username (e.g., `\"octocat\"`).\nFor GitHub teams, use the format `github:org:team` (e.g., `\"github:rust-lang:owners\"`).","example":["octocat","github:rust-lang:owners"]}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["msg","ok"],"properties":{"msg":{"type":"string","description":"A message describing the result of the operation.","example":"user ghost has been invited to be an owner of crate serde"},"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]},"delete":{"tags":["owners"],"summary":"Remove crate owners.","operationId":"remove_owners","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["owners"],"properties":{"owners":{"type":"array","items":{"type":"string"},"description":"List of owner login names to add or remove.\n\nFor users, use just the username (e.g., `\"octocat\"`).\nFor GitHub teams, use the format `github:org:team` (e.g., `\"github:rust-lang:owners\"`).","example":["octocat","github:rust-lang:owners"]}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["msg","ok"],"properties":{"msg":{"type":"string","description":"A message describing the result of the operation.","example":"user ghost has been invited to be an owner of crate serde"},"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/crates/{name}/reverse_dependencies":{"get":{"tags":["crates"],"summary":"List reverse dependencies of a crate.","operationId":"list_reverse_dependencies","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["dependencies","versions","meta"],"properties":{"dependencies":{"type":"array","items":{"$ref":"#/components/schemas/EncodableDependency"},"description":"The list of reverse dependencies of the crate."},"meta":{"type":"object","required":["total"],"properties":{"total":{"type":"integer","format":"int64","example":32}}},"versions":{"type":"array","items":{"$ref":"#/components/schemas/Version"},"description":"The versions referenced in the `dependencies` field."}}}}}}}}},"/api/v1/crates/{name}/versions":{"get":{"tags":["versions"],"summary":"List all versions of a crate.","operationId":"list_versions","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"include","in":"query","description":"Additional data to include in the response.\n\nValid values: `release_tracks`.\n\nDefaults to no additional data.\n\nThis parameter expects a comma-separated list of values.","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"The sort order of the versions.\n\nValid values: `date`, and `semver`.\n\nDefaults to `semver`.","required":false,"schema":{"type":"string"}},{"name":"nums[]","in":"query","description":"If set, only versions with the specified semver strings are returned.","required":false,"schema":{"type":"array","items":{"type":"string","description":"A string that does not contain null bytes (`\\0`)."}}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["versions","meta"],"properties":{"meta":{"type":"object","required":["total"],"properties":{"next_page":{"type":["string","null"],"description":"Query string to the next page of results, if any.","example":"?page=3"},"release_tracks":{"type":["object","null"],"description":"Additional data about the crate's release tracks,\nif `?include=release_tracks` is used."},"total":{"type":"integer","format":"int64","description":"The total number of versions belonging to the crate.","example":123}}},"versions":{"type":"array","items":{"$ref":"#/components/schemas/Version"}}}}}}}}}},"/api/v1/crates/{name}/{version}":{"get":{"tags":["versions"],"summary":"Get crate version metadata.","operationId":"find_version","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["version"],"properties":{"version":{"$ref":"#/components/schemas/Version"}}}}}}}},"patch":{"tags":["versions"],"summary":"Update a crate version.","description":"This endpoint allows updating the `yanked` state of a version, including a yank message.","operationId":"update_version","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["version"],"properties":{"version":{"$ref":"#/components/schemas/Version"}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/crates/{name}/{version}/authors":{"get":{"tags":["versions"],"summary":"Get crate version authors.","description":"This endpoint was deprecated by [RFC #3052](https://github.com/rust-lang/rfcs/pull/3052)\nand returns an empty list for backwards compatibility reasons.","operationId":"get_version_authors","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response"}},"deprecated":true}},"/api/v1/crates/{name}/{version}/dependencies":{"get":{"tags":["versions"],"summary":"Get crate version dependencies.","description":"This information can also be obtained directly from the index.\n\nIn addition to returning cached data from the index, this returns\nfields for `id`, `version_id`, and `downloads` (which appears to always\nbe 0)","operationId":"get_version_dependencies","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["dependencies"],"properties":{"dependencies":{"type":"array","items":{"$ref":"#/components/schemas/EncodableDependency"}}}}}}}}}},"/api/v1/crates/{name}/{version}/download":{"get":{"tags":["versions"],"summary":"Download a crate version.","description":"This returns a URL to the location where the crate is stored.","operationId":"download_version","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response (for `content-type: application/json`)","content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"The URL to the crate file.","example":"https://static.crates.io/crates/serde/serde-1.0.0.crate"}}}}}},"302":{"description":"Successful Response (default)","headers":{"location":{"schema":{"type":"string"},"description":"The URL to the crate file."}}}}}},"/api/v1/crates/{name}/{version}/downloads":{"get":{"tags":["versions"],"summary":"Get the download counts for a crate version.","description":"This includes the per-day downloads for the last 90 days.","operationId":"get_version_downloads","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"},{"name":"before_date","in":"query","description":"Only return download counts before this date.","required":false,"schema":{"type":"string","format":"date"},"example":"2024-06-28"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["version_downloads"],"properties":{"version_downloads":{"type":"array","items":{"$ref":"#/components/schemas/VersionDownload"}}}}}}}}}},"/api/v1/crates/{name}/{version}/readme":{"get":{"tags":["versions"],"summary":"Get the readme of a crate version.","operationId":"get_version_readme","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response (for `content-type: application/json`)","content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","description":"The URL to the readme file.","example":"https://static.crates.io/readmes/serde/serde-1.0.0.html"}}}}}},"302":{"description":"Successful Response (default)","headers":{"location":{"schema":{"type":"string"},"description":"The URL to the readme file."}}}}}},"/api/v1/crates/{name}/{version}/rebuild_docs":{"post":{"tags":["versions"],"summary":"Trigger a rebuild for the crate documentation on docs.rs.","operationId":"rebuild_version_docs","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"201":{"description":"Successful Response"}},"security":[{"cookie":[]}]}},"/api/v1/crates/{name}/{version}/unyank":{"put":{"tags":["versions"],"summary":"Unyank a crate version.","operationId":"unyank_version","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/crates/{name}/{version}/yank":{"delete":{"tags":["versions"],"summary":"Yank a crate version.","description":"This does not delete a crate version, it makes the crate\nversion accessible only to crates that already have a\n`Cargo.lock` containing this version.\n\nNotes:\n\nVersion deletion is not implemented to avoid breaking builds,\nand the goal of yanking a crate is to prevent crates\nbeginning to depend on the yanked crate version.","operationId":"yank_version","parameters":[{"name":"name","in":"path","description":"Name of the crate","required":true,"schema":{"type":"string"}},{"name":"version","in":"path","description":"Version number","required":true,"schema":{"type":"string"},"example":"1.0.0"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/keywords":{"get":{"tags":["keywords"],"summary":"List all keywords.","operationId":"list_keywords","parameters":[{"name":"sort","in":"query","description":"The sort order of the keywords.\n\nValid values: `alpha`, and `crates`.\n\nDefaults to `alpha`.","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["keywords","meta"],"properties":{"keywords":{"type":"array","items":{"$ref":"#/components/schemas/Keyword"},"description":"The list of keywords."},"meta":{"type":"object","required":["total"],"properties":{"total":{"type":"integer","format":"int64","description":"The total number of keywords.","example":123}}}}}}}}}}},"/api/v1/keywords/{keyword}":{"get":{"tags":["keywords"],"summary":"Get keyword metadata.","operationId":"find_keyword","parameters":[{"name":"keyword","in":"path","description":"The keyword to find","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["keyword"],"properties":{"keyword":{"$ref":"#/components/schemas/Keyword"}}}}}}}}},"/api/v1/me":{"get":{"tags":["users"],"summary":"Get the currently authenticated user.","operationId":"get_authenticated_user","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["user","owned_crates"],"properties":{"owned_crates":{"type":"array","items":{"type":"object","required":["id","name","email_notifications"],"properties":{"email_notifications":{"type":"boolean","deprecated":true},"id":{"type":"integer","format":"int32","description":"The opaque identifier of the crate.","example":123},"name":{"type":"string","description":"The name of the crate.","example":"serde"}}},"description":"The crates that the authenticated user owns."},"user":{"$ref":"#/components/schemas/AuthenticatedUser","description":"The authenticated user."}}}}}}},"security":[{"cookie":[]}]}},"/api/v1/me/crate_owner_invitations":{"get":{"tags":["owners"],"summary":"List all crate owner invitations for the authenticated user.","operationId":"list_crate_owner_invitations_for_user","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate_owner_invitations","users"],"properties":{"crate_owner_invitations":{"type":"array","items":{"$ref":"#/components/schemas/LegacyCrateOwnerInvitation"},"description":"The list of crate owner invitations."},"users":{"type":"array","items":{"$ref":"#/components/schemas/User"},"description":"The list of users referenced in the crate owner invitations."}}}}}}},"security":[{"cookie":[]}]}},"/api/v1/me/crate_owner_invitations/accept/{token}":{"put":{"tags":["owners"],"summary":"Accept a crate owner invitation with a token.","operationId":"accept_crate_owner_invitation_with_token","parameters":[{"name":"token","in":"path","description":"Secret token sent to the user's email address","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate_owner_invitation"],"properties":{"crate_owner_invitation":{"type":"object","required":["crate_id","accepted"],"properties":{"accepted":{"type":"boolean","description":"Whether the invitation was accepted.","example":true},"crate_id":{"type":"integer","format":"int32","description":"The opaque identifier for the crate this invitation is for.","example":42}}}}}}}}}}},"/api/v1/me/crate_owner_invitations/{crate_id}":{"put":{"tags":["owners"],"summary":"Accept or decline a crate owner invitation.","operationId":"handle_crate_owner_invitation","parameters":[{"name":"crate_id","in":"path","description":"ID of the crate","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["crate_owner_invitation"],"properties":{"crate_owner_invitation":{"type":"object","required":["crate_id","accepted"],"properties":{"accepted":{"type":"boolean","description":"Whether the invitation was accepted.","example":true},"crate_id":{"type":"integer","format":"int32","description":"The opaque identifier for the crate this invitation is for.","example":42}}}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/me/email_notifications":{"put":{"tags":["users"],"summary":"Update email notification settings for the authenticated user.","description":"This endpoint was implemented for an experimental feature that was never\nfully implemented. It is now deprecated and will be removed in the future.","operationId":"update_email_notifications","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"deprecated":true,"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/me/tokens":{"get":{"tags":["api_tokens"],"summary":"List all API tokens of the authenticated user.","operationId":"list_api_tokens","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["api_tokens"],"properties":{"api_tokens":{"type":"array","items":{"$ref":"#/components/schemas/ApiToken"}}}}}}}},"security":[{"cookie":[]}]},"put":{"tags":["api_tokens"],"summary":"Create a new API token.","operationId":"create_api_token","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["api_token"],"properties":{"api_token":{"$ref":"#/components/schemas/EncodableApiTokenWithToken"}}}}}}},"security":[{"cookie":[]}]}},"/api/v1/me/tokens/{id}":{"get":{"tags":["api_tokens"],"summary":"Find API token by id.","operationId":"find_api_token","parameters":[{"name":"id","in":"path","description":"ID of the API token","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["api_token"],"properties":{"api_token":{"$ref":"#/components/schemas/ApiToken"}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]},"delete":{"tags":["api_tokens"],"summary":"Revoke API token.","operationId":"revoke_api_token","parameters":[{"name":"id","in":"path","description":"ID of the API token","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object"}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/me/updates":{"get":{"tags":["versions"],"summary":"List versions of crates that the authenticated user follows.","operationId":"get_authenticated_user_updates","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["versions","meta"],"properties":{"meta":{"type":"object","required":["more"],"properties":{"more":{"type":"boolean","description":"Whether there are more versions to be loaded."}}},"versions":{"type":"array","items":{"$ref":"#/components/schemas/Version"},"description":"The list of recent versions of crates that the authenticated user follows."}}}}}}},"security":[{"cookie":[]}]}},"/api/v1/site_metadata":{"get":{"tags":["other"],"summary":"Get crates.io metadata.","description":"Returns the current deployed commit SHA1 (or `unknown`), and whether the\nsystem is in read-only mode.","operationId":"get_site_metadata","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["deployed_sha","commit","read_only"],"properties":{"banner_message":{"type":["string","null"],"description":"Optional banner message to display on all pages."},"commit":{"type":"string","description":"The SHA1 of the currently deployed commit.","example":"0aebe2cdfacae1229b93853b1c58f9352195f081"},"deployed_sha":{"type":"string","description":"The SHA1 of the currently deployed commit.","example":"0aebe2cdfacae1229b93853b1c58f9352195f081"},"read_only":{"type":"boolean","description":"Whether the crates.io service is in read-only mode."}}}}}}}}},"/api/v1/summary":{"get":{"tags":["other"],"summary":"Get front page data.","description":"This endpoint returns a summary of the most important data for the front\npage of crates.io.","operationId":"get_summary","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["num_downloads","num_crates","new_crates","most_downloaded","most_recently_downloaded","just_updated","popular_keywords","popular_categories"],"properties":{"just_updated":{"type":"array","items":{"$ref":"#/components/schemas/Crate"},"description":"The 10 most recently updated crates."},"most_downloaded":{"type":"array","items":{"$ref":"#/components/schemas/Crate"},"description":"The 10 crates with the highest total number of downloads."},"most_recently_downloaded":{"type":"array","items":{"$ref":"#/components/schemas/Crate"},"description":"The 10 crates with the highest number of downloads within the last 90 days."},"new_crates":{"type":"array","items":{"$ref":"#/components/schemas/Crate"},"description":"The 10 most recently created crates."},"num_crates":{"type":"integer","format":"int64","description":"The total number of crates on crates.io.","example":123456},"num_downloads":{"type":"integer","format":"int64","description":"The total number of downloads across all crates.","example":123456789},"popular_categories":{"type":"array","items":{"$ref":"#/components/schemas/Category"},"description":"The 10 most popular categories."},"popular_keywords":{"type":"array","items":{"$ref":"#/components/schemas/Keyword"},"description":"The 10 most popular keywords."}}}}}}}}},"/api/v1/teams/{team}":{"get":{"tags":["teams"],"summary":"Find team by login.","operationId":"find_team","parameters":[{"name":"team","in":"path","description":"Name of the team","required":true,"schema":{"type":"string"},"example":"github:rust-lang:crates-io"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["team"],"properties":{"team":{"$ref":"#/components/schemas/Team"}}}}}}}}},"/api/v1/tokens/current":{"delete":{"tags":["api_tokens"],"summary":"Revoke the current API token.","description":"This endpoint revokes the API token that is used to authenticate\nthe request.","operationId":"revoke_current_api_token","responses":{"204":{"description":"Successful Response"}},"security":[{"api_token":[]}]}},"/api/v1/trusted_publishing/github_configs":{"get":{"tags":["trusted_publishing"],"summary":"List Trusted Publishing configurations for GitHub Actions.","operationId":"list_trustpub_github_configs","parameters":[{"name":"crate","in":"query","description":"Name of the crate to list Trusted Publishing configurations for.","required":false,"schema":{"type":"string"}},{"name":"user_id","in":"query","description":"User ID to list Trusted Publishing configurations for all crates owned by the user.","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["github_configs","meta"],"properties":{"github_configs":{"type":"array","items":{"$ref":"#/components/schemas/GitHubConfig"}},"meta":{"type":"object","required":["total"],"properties":{"next_page":{"type":["string","null"],"description":"Query string to the next page of results, if any.","example":"?seek=abc123"},"total":{"type":"integer","format":"int64","description":"The total number of GitHub configs belonging to the crate.","example":42}}}}}}}}},"security":[{"cookie":[]},{"api_token":[]}]},"post":{"tags":["trusted_publishing"],"summary":"Create a new Trusted Publishing configuration for GitHub Actions.","operationId":"create_trustpub_github_config","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["github_config"],"properties":{"github_config":{"type":"object","required":["crate","repository_owner","repository_name","workflow_filename"],"properties":{"crate":{"type":"string","example":"regex"},"environment":{"type":["string","null"],"example":null},"repository_name":{"type":"string","example":"regex"},"repository_owner":{"type":"string","example":"rust-lang"},"workflow_filename":{"type":"string","example":"ci.yml"}}}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["github_config"],"properties":{"github_config":{"$ref":"#/components/schemas/GitHubConfig"}}}}}}},"security":[{"cookie":[]},{"api_token":[]}]}},"/api/v1/trusted_publishing/github_configs/{id}":{"delete":{"tags":["trusted_publishing"],"summary":"Delete Trusted Publishing configuration for GitHub Actions.","operationId":"delete_trustpub_github_config","parameters":[{"name":"id","in":"path","description":"ID of the Trusted Publishing configuration","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"204":{"description":"Successful Response"}},"security":[{"cookie":[]},{"api_token":[]}]}},"/api/v1/trusted_publishing/gitlab_configs":{"get":{"tags":["trusted_publishing"],"summary":"List Trusted Publishing configurations for GitLab CI/CD.","operationId":"list_trustpub_gitlab_configs","parameters":[{"name":"crate","in":"query","description":"Name of the crate to list Trusted Publishing configurations for.","required":false,"schema":{"type":"string"}},{"name":"user_id","in":"query","description":"User ID to list Trusted Publishing configurations for all crates owned by the user.","required":false,"schema":{"type":"integer","format":"int32"}},{"name":"page","in":"query","description":"The page number to request.\n\nThis parameter is mutually exclusive with `seek` and not supported for\nall requests.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"per_page","in":"query","description":"The number of items to request per page.","required":false,"schema":{"type":"integer","format":"int32","minimum":1}},{"name":"seek","in":"query","description":"The seek key to request.\n\nThis parameter is mutually exclusive with `page` and not supported for\nall requests.\n\nThe seek key can usually be found in the `meta.next_page` field of\npaginated responses.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["gitlab_configs","meta"],"properties":{"gitlab_configs":{"type":"array","items":{"$ref":"#/components/schemas/GitLabConfig"}},"meta":{"type":"object","required":["total"],"properties":{"next_page":{"type":["string","null"],"description":"Query string to the next page of results, if any.","example":"?seek=abc123"},"total":{"type":"integer","format":"int64","description":"The total number of GitLab configs belonging to the crate.","example":42}}}}}}}}},"security":[{"cookie":[]},{"api_token":[]}]},"post":{"tags":["trusted_publishing"],"operationId":"create_trustpub_gitlab_config","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["gitlab_config"],"properties":{"gitlab_config":{"type":"object","required":["crate","namespace","project","workflow_filepath"],"properties":{"crate":{"type":"string","example":"regex"},"environment":{"type":["string","null"],"example":null},"namespace":{"type":"string","example":"rust-lang"},"project":{"type":"string","example":"regex"},"workflow_filepath":{"type":"string","example":".gitlab-ci.yml"}}}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["gitlab_config"],"properties":{"gitlab_config":{"$ref":"#/components/schemas/GitLabConfig"}}}}}}},"security":[{"cookie":[]},{"api_token":[]}]}},"/api/v1/trusted_publishing/gitlab_configs/{id}":{"delete":{"tags":["trusted_publishing"],"summary":"Delete Trusted Publishing configuration for GitLab CI/CD.","operationId":"delete_trustpub_gitlab_config","parameters":[{"name":"id","in":"path","description":"ID of the Trusted Publishing configuration","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"204":{"description":"Successful Response"}},"security":[{"cookie":[]},{"api_token":[]}]}},"/api/v1/trusted_publishing/tokens":{"post":{"tags":["trusted_publishing"],"summary":"Exchange an OIDC token for a temporary access token.","operationId":"exchange_trustpub_token","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["jwt"],"properties":{"jwt":{"type":"string"}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string"}}}}}}}},"delete":{"tags":["trusted_publishing"],"summary":"Revoke a temporary access token.","description":"The access token is expected to be passed in the `Authorization` header\nas a `Bearer` token, similar to how it is used in the publish endpoint.","operationId":"revoke_trustpub_token","responses":{"204":{"description":"Successful Response"}},"security":[{"trustpub_token":[]}]}},"/api/v1/users/{id}/resend":{"put":{"tags":["users"],"summary":"Regenerate and send an email verification token.","operationId":"resend_email_verification","parameters":[{"name":"id","in":"path","description":"ID of the user","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}},"/api/v1/users/{id}/stats":{"get":{"tags":["users"],"summary":"Get user stats.","description":"This currently only returns the total number of downloads for crates owned\nby the user.","operationId":"get_user_stats","parameters":[{"name":"id","in":"path","description":"ID of the user","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["total_downloads"],"properties":{"total_downloads":{"type":"integer","format":"int64","description":"The total number of downloads for crates owned by the user.","example":123456789,"minimum":0}}}}}}}}},"/api/v1/users/{user}":{"get":{"tags":["users"],"summary":"Find user by login.","operationId":"find_user","parameters":[{"name":"user","in":"path","description":"Login name of the user","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"$ref":"#/components/schemas/User"}}}}}}}},"put":{"tags":["users"],"summary":"Update user settings.","description":"This endpoint allows users to update their email address and publish notifications settings.\n\nThe `id` parameter needs to match the ID of the currently authenticated user.","operationId":"update_user","parameters":[{"name":"user","in":"path","description":"ID of the user","required":true,"schema":{"type":"integer","format":"int32"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["user"],"properties":{"user":{"type":"object","properties":{"email":{"type":["string","null"]},"publish_notifications":{"type":["boolean","null"]}}}}}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","required":["ok"],"properties":{"ok":{"type":"boolean","example":true}}}}}}},"security":[{"api_token":[]},{"cookie":[]}]}}},"components":{"schemas":{"ApiToken":{"type":"object","description":"The model representing a row in the `api_tokens` database table.","required":["id","name","created_at"],"properties":{"crate_scopes":{"type":["array","null"],"items":{"type":"string"},"description":"`None` or a list of crate scope patterns (see RFC #2947).","example":["serde"]},"created_at":{"type":"string","format":"date-time","description":"The date and time when the token was created.","example":"2017-01-06T14:23:11Z"},"endpoint_scopes":{"type":["array","null"],"items":{"$ref":"#/components/schemas/EndpointScope"},"description":"A list of endpoint scopes or `None` for the `legacy` endpoint scope (see RFC #2947).","example":["publish-update"]},"expired_at":{"type":["string","null"],"format":"date-time","description":"The date and time when the token will expire, or `null`.","example":"2030-10-26T11:32:12Z"},"id":{"type":"integer","format":"int32","description":"An opaque unique identifier for the token.","example":42},"last_used_at":{"type":["string","null"],"format":"date-time","description":"The date and time when the token was last used.","example":"2021-10-26T11:32:12Z"},"name":{"type":"string","description":"The name of the token.","example":"Example API Token"}}},"AuthenticatedUser":{"type":"object","required":["id","login","email_verified","email_verification_sent","is_admin","publish_notifications"],"properties":{"avatar":{"type":["string","null"],"description":"The user's avatar URL, if set.","example":"https://avatars2.githubusercontent.com/u/1234567?v=4"},"email":{"type":["string","null"],"description":"The user's email address, if set.","example":"kate@morgan.dev"},"email_verification_sent":{"type":"boolean","description":"Whether the user's email address verification email has been sent.","example":true},"email_verified":{"type":"boolean","description":"Whether the user's email address has been verified.","example":true},"id":{"type":"integer","format":"int32","description":"An opaque identifier for the user.","example":42},"is_admin":{"type":"boolean","description":"Whether the user is a crates.io administrator.","example":false},"login":{"type":"string","description":"The user's login name.","example":"ghost"},"name":{"type":["string","null"],"description":"The user's display name, if set.","example":"Kate Morgan"},"publish_notifications":{"type":"boolean","description":"Whether the user has opted in to receive publish notifications via email.","example":true},"url":{"type":["string","null"],"description":"The user's GitHub profile URL.","example":"https://github.com/ghost"}}},"Category":{"type":"object","required":["id","category","slug","description","created_at","crates_cnt"],"properties":{"category":{"type":"string","description":"The name of the category.","example":"Game development"},"crates_cnt":{"type":"integer","format":"int32","description":"The total number of crates that have this category.","example":42},"created_at":{"type":"string","format":"date-time","description":"The date and time this category was created.","example":"2019-12-13T13:46:41Z"},"description":{"type":"string","description":"A description of the category.","example":"Libraries for creating games."},"id":{"type":"string","description":"An opaque identifier for the category.","example":"game-development"},"parent_categories":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Category"},"description":"The parent categories of this category.\n\nThis field is only present when the category details are queried,\nbut not when listing categories.","example":[]},"slug":{"type":"string","description":"The \"slug\" of the category.\n\nSee <https://crates.io/category_slugs>.","example":"game-development"},"subcategories":{"type":["array","null"],"items":{"$ref":"#/components/schemas/Category"},"description":"The subcategories of this category.\n\nThis field is only present when the category details are queried,\nbut not when listing categories.","example":[]}}},"Crate":{"type":"object","required":["id","name","updated_at","badges","created_at","downloads","num_versions","yanked","max_version","newest_version","links","exact_match","trustpub_only"],"properties":{"badges":{"type":"array","items":{"type":"object"},"deprecated":true,"example":[]},"categories":{"type":["array","null"],"items":{"type":"string"},"description":"The list of categories belonging to this crate.","example":null},"created_at":{"type":"string","format":"date-time","description":"The date and time this crate was created.","example":"2019-12-13T13:46:41Z"},"default_version":{"type":["string","null"],"description":"The \"default\" version of this crate.\n\nThis version will be displayed by default on the crate's page.","example":"1.3.0"},"description":{"type":["string","null"],"description":"Description of the crate.","example":"A generic serialization/deserialization framework"},"documentation":{"type":["string","null"],"description":"The URL to the crate's documentation, if set.","example":"https://docs.rs/serde"},"downloads":{"type":"integer","format":"int64","description":"The total number of downloads for this crate.","example":123456789},"exact_match":{"type":"boolean","description":"Whether the crate name was an exact match.","deprecated":true},"homepage":{"type":["string","null"],"description":"The URL to the crate's homepage, if set.","example":"https://serde.rs"},"id":{"type":"string","description":"An opaque identifier for the crate.","example":"serde"},"keywords":{"type":["array","null"],"items":{"type":"string"},"description":"The list of keywords belonging to this crate.","example":null},"links":{"$ref":"#/components/schemas/CrateLinks","description":"Links to other API endpoints related to this crate."},"max_stable_version":{"type":["string","null"],"description":"The highest version number for this crate that is not a pre-release.","deprecated":true,"example":"1.3.0"},"max_version":{"type":"string","description":"The highest version number for this crate.","deprecated":true,"example":"2.0.0-beta.1"},"name":{"type":"string","description":"The name of the crate.","example":"serde"},"newest_version":{"type":"string","description":"The most recently published version for this crate.","deprecated":true,"example":"1.2.3"},"num_versions":{"type":"integer","format":"int32","description":"The total number of versions for this crate.","example":13},"recent_downloads":{"type":["integer","null"],"format":"int64","description":"The total number of downloads for this crate in the last 90 days.","example":456789},"repository":{"type":["string","null"],"description":"The URL to the crate's repository, if set.","example":"https://github.com/serde-rs/serde"},"trustpub_only":{"type":"boolean","description":"Whether this crate can only be published via Trusted Publishing."},"updated_at":{"type":"string","format":"date-time","description":"The date and time this crate was last updated.","example":"2019-12-13T13:46:41Z"},"versions":{"type":["array","null"],"items":{"type":"integer","format":"int32"},"description":"The list of version IDs belonging to this crate.","example":null},"yanked":{"type":"boolean","description":"Whether all versions of this crate have been yanked."}}},"CrateLinks":{"type":"object","required":["version_downloads","reverse_dependencies"],"properties":{"owner_team":{"type":["string","null"],"description":"The API path to this crate's team owners.","example":"/api/v1/crates/serde/owner_team"},"owner_user":{"type":["string","null"],"description":"The API path to this crate's user owners.","example":"/api/v1/crates/serde/owner_user"},"owners":{"type":["string","null"],"description":"The API path to this crate's owners.","example":"/api/v1/crates/serde/owners"},"reverse_dependencies":{"type":"string","description":"The API path to this crate's reverse dependencies.","example":"/api/v1/crates/serde/reverse_dependencies"},"version_downloads":{"type":"string","description":"The API path to this crate's download statistics.","example":"/api/v1/crates/serde/downloads"},"versions":{"type":["string","null"],"description":"The API path to this crate's versions.","example":"/api/v1/crates/serde/versions"}}},"CrateOwnerInvitation":{"type":"object","required":["invitee_id","inviter_id","crate_id","crate_name","created_at","expires_at"],"properties":{"crate_id":{"type":"integer","format":"int32","description":"The ID of the crate that the user was invited to be an owner of.","example":123},"crate_name":{"type":"string","description":"The name of the crate that the user was invited to be an owner of.","example":"serde"},"created_at":{"type":"string","format":"date-time","description":"The date and time this invitation was created.","example":"2019-12-13T13:46:41Z"},"expires_at":{"type":"string","format":"date-time","description":"The date and time this invitation will expire.","example":"2020-01-13T13:46:41Z"},"invitee_id":{"type":"integer","format":"int32","description":"The ID of the user who was invited to be a crate owner.","example":42},"inviter_id":{"type":"integer","format":"int32","description":"The ID of the user who sent the invitation.","example":3}}},"EncodableApiTokenWithToken":{"allOf":[{"$ref":"#/components/schemas/ApiToken"},{"type":"object","required":["token"],"properties":{"token":{"type":"string","description":"The plaintext API token.\n\nOnly available when the token is created.","example":"a1b2c3d4e5f6g7h8i9j0"}}}]},"EncodableDependency":{"type":"object","required":["id","version_id","crate_id","req","optional","default_features","features","kind","downloads"],"properties":{"crate_id":{"type":"string","description":"The name of the crate this dependency points to.","example":"serde"},"default_features":{"type":"boolean","description":"Whether default features are enabled for this dependency.","example":true},"downloads":{"type":"integer","format":"int64","description":"The total number of downloads for the crate this dependency points to.","example":123456},"features":{"type":"array","items":{"type":"string"},"description":"The features explicitly enabled for this dependency."},"id":{"type":"integer","format":"int32","description":"An opaque identifier for the dependency.","example":169},"kind":{"type":"string","description":"The type of dependency this is (normal, dev, or build).","example":"normal"},"optional":{"type":"boolean","description":"Whether this dependency is optional."},"req":{"type":"string","description":"The version requirement for this dependency.","example":"^1"},"target":{"type":["string","null"],"description":"The target platform for this dependency, if any."},"version_id":{"type":"integer","format":"int32","description":"The ID of the version this dependency belongs to.","example":42}}},"EndpointScope":{"type":"string","enum":["publish-new","publish-update","trusted-publishing","yank","change-owners"]},"GitHubConfig":{"type":"object","required":["id","crate","repository_owner","repository_owner_id","repository_name","workflow_filename","created_at"],"properties":{"crate":{"type":"string","example":"regex"},"created_at":{"type":"string","format":"date-time"},"environment":{"type":["string","null"],"example":null},"id":{"type":"integer","format":"int32","example":42},"repository_name":{"type":"string","example":"regex"},"repository_owner":{"type":"string","example":"rust-lang"},"repository_owner_id":{"type":"integer","format":"int32","example":5430905},"workflow_filename":{"type":"string","example":"ci.yml"}}},"GitLabConfig":{"type":"object","required":["id","crate","namespace","project","workflow_filepath","created_at"],"properties":{"crate":{"type":"string","example":"regex"},"created_at":{"type":"string","format":"date-time"},"environment":{"type":["string","null"],"example":null},"id":{"type":"integer","format":"int32","example":42},"namespace":{"type":"string","example":"rust-lang"},"namespace_id":{"type":["string","null"],"example":null},"project":{"type":"string","example":"regex"},"workflow_filepath":{"type":"string","example":".gitlab-ci.yml"}}},"Keyword":{"type":"object","required":["id","keyword","created_at","crates_cnt"],"properties":{"crates_cnt":{"type":"integer","format":"int32","description":"The total number of crates that have this keyword.","example":42},"created_at":{"type":"string","format":"date-time","description":"The date and time this keyword was created.","example":"2017-01-06T14:23:11Z"},"id":{"type":"string","description":"An opaque identifier for the keyword.","example":"http"},"keyword":{"type":"string","description":"The keyword itself.","example":"http"}}},"LegacyCrateOwnerInvitation":{"type":"object","required":["invitee_id","inviter_id","invited_by_username","crate_name","crate_id","created_at","expires_at"],"properties":{"crate_id":{"type":"integer","format":"int32","description":"The ID of the crate that the user was invited to be an owner of.","example":123},"crate_name":{"type":"string","description":"The name of the crate that the user was invited to be an owner of.","example":"serde"},"created_at":{"type":"string","format":"date-time","description":"The date and time this invitation was created.","example":"2019-12-13T13:46:41Z"},"expires_at":{"type":"string","format":"date-time","description":"The date and time this invitation will expire.","example":"2020-01-13T13:46:41Z"},"invited_by_username":{"type":"string","description":"The username of the user who sent the invitation.","example":"ghost"},"invitee_id":{"type":"integer","format":"int32","description":"The ID of the user who was invited to be a crate owner.","example":42},"inviter_id":{"type":"integer","format":"int32","description":"The ID of the user who sent the invitation.","example":3}}},"Owner":{"type":"object","required":["id","login","kind"],"properties":{"avatar":{"type":["string","null"],"description":"The avatar URL of the team or user.","example":"https://avatars2.githubusercontent.com/u/1234567?v=4"},"id":{"type":"integer","format":"int32","description":"The opaque identifier for the team or user, depending on the `kind` field.","example":42},"kind":{"type":"string","description":"The kind of the owner (`user` or `team`).","example":"user"},"login":{"type":"string","description":"The login name of the team or user.","example":"ghost"},"name":{"type":["string","null"],"description":"The display name of the team or user.","example":"Kate Morgan"},"url":{"type":["string","null"],"description":"The URL to the owner's profile.","example":"https://github.com/ghost"}}},"PublishWarnings":{"type":"object","required":["invalid_categories","invalid_badges","other"],"properties":{"invalid_badges":{"type":"array","items":{"type":"string"},"deprecated":true,"example":[]},"invalid_categories":{"type":"array","items":{"type":"string"},"example":[]},"other":{"type":"array","items":{"type":"string"},"example":[]}}},"Slug":{"type":"object","required":["id","slug","description"],"properties":{"description":{"type":"string","description":"A description of the category.","example":"Libraries for creating games."},"id":{"type":"string","description":"An opaque identifier for the category.","example":"game-development"},"slug":{"type":"string","description":"The \"slug\" of the category.\n\nSee <https://crates.io/category_slugs>.","example":"game-development"}}},"Team":{"type":"object","required":["id","login"],"properties":{"avatar":{"type":["string","null"],"description":"The avatar URL of the team.","example":"https://avatars2.githubusercontent.com/u/1234567?v=4"},"id":{"type":"integer","format":"int32","description":"An opaque identifier for the team.","example":42},"login":{"type":"string","description":"The login name of the team.","example":"github:rust-lang:crates-io"},"name":{"type":["string","null"],"description":"The display name of the team.","example":"Crates.io team"},"url":{"type":["string","null"],"description":"The GitHub profile URL of the team.","example":"https://github.com/rust-lang"}}},"User":{"type":"object","required":["id","login","url"],"properties":{"avatar":{"type":["string","null"],"description":"The user's avatar URL, if set.","example":"https://avatars2.githubusercontent.com/u/1234567?v=4"},"id":{"type":"integer","format":"int32","description":"An opaque identifier for the user.","example":42},"login":{"type":"string","description":"The user's login name.","example":"ghost"},"name":{"type":["string","null"],"description":"The user's display name, if set.","example":"Kate Morgan"},"url":{"type":"string","description":"The user's GitHub profile URL.","example":"https://github.com/ghost"}}},"Version":{"type":"object","required":["id","crate","num","dl_path","readme_path","updated_at","created_at","downloads","features","yanked","links","crate_size","audit_actions","checksum","linecounts"],"properties":{"audit_actions":{"type":"array","items":{"type":"object","required":["action","user","time"],"properties":{"action":{"type":"string","description":"The action that was performed.","example":"publish"},"time":{"type":"string","format":"date-time","description":"The date and time the action was performed.","example":"2019-12-13T13:46:41Z"},"user":{"$ref":"#/components/schemas/User","description":"The user who performed the action."}}},"description":"A list of actions performed on this version."},"bin_names":{"type":["array","null"],"items":{"type":["string","null"]},"description":"The names of the binaries provided by this version, if any.","example":[]},"checksum":{"type":"string","description":"The SHA256 checksum of the compressed crate file encoded as a\nhexadecimal string.","example":"e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60"},"crate":{"type":"string","description":"The name of the crate.","example":"serde"},"crate_size":{"type":"integer","format":"int32","description":"The size of the compressed crate file in bytes.","example":1234},"created_at":{"type":"string","format":"date-time","description":"The date and time this version was created.","example":"2019-12-13T13:46:41Z"},"description":{"type":["string","null"],"description":"The description of this version of the crate.","example":"A generic serialization/deserialization framework"},"dl_path":{"type":"string","description":"The API path to download the crate.","example":"/api/v1/crates/serde/1.0.0/download"},"documentation":{"type":["string","null"],"description":"The URL to the crate's documentation, if set.","example":"https://docs.rs/serde"},"downloads":{"type":"integer","format":"int32","description":"The total number of downloads for this version.","example":123456},"edition":{"type":["string","null"],"description":"The Rust Edition used to compile this version, if set.","example":"2021"},"features":{"type":"object","description":"The features defined by this version."},"has_lib":{"type":["boolean","null"],"description":"Whether this version can be used as a library.","example":true},"homepage":{"type":["string","null"],"description":"The URL to the crate's homepage, if set.","example":"https://serde.rs"},"id":{"type":"integer","format":"int32","description":"An opaque identifier for the version.","example":42},"lib_links":{"type":["string","null"],"description":"The name of the native library this version links with, if any.","example":"git2"},"license":{"type":["string","null"],"description":"The license of this version of the crate.","example":"MIT"},"linecounts":{"type":"object","description":"Line count statistics for this version.\n\nStatus: **Unstable**\n\nThis field may be `null` until the version has been analyzed, which\nhappens in an asynchronous background job."},"links":{"$ref":"#/components/schemas/VersionLinks","description":"Links to other API endpoints related to this version."},"num":{"type":"string","description":"The version number.","example":"1.0.0"},"published_by":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/User","description":"The user who published this version.\n\nThis field may be `null` if the version was published before crates.io\nstarted recording this information."}]},"readme_path":{"type":"string","description":"The API path to download the crate's README file as HTML code.","example":"/api/v1/crates/serde/1.0.0/readme"},"repository":{"type":["string","null"],"description":"The URL to the crate's repository, if set.","example":"https://github.com/serde-rs/serde"},"rust_version":{"type":["string","null"],"description":"The minimum version of the Rust compiler required to compile\nthis version, if set.","example":"1.31"},"trustpub_data":{"type":["object","null"],"description":"Information about the trusted publisher that published this version, if any.\n\nStatus: **Unstable**\n\nThis field is filled if the version was published via trusted publishing\n(e.g., GitHub Actions) rather than a regular API token.\n\nThe exact structure of this field depends on the `provider` field\ninside it."},"updated_at":{"type":"string","format":"date-time","description":"The date and time this version was last updated (i.e. yanked or unyanked).","example":"2019-12-13T13:46:41Z"},"yank_message":{"type":["string","null"],"description":"The message given when this version was yanked, if any.","example":"Security vulnerability"},"yanked":{"type":"boolean","description":"Whether this version has been yanked.","example":false}}},"VersionDownload":{"type":"object","required":["version","downloads","date"],"properties":{"date":{"type":"string","description":"The date this download count is for.","example":"2019-12-13"},"downloads":{"type":"integer","format":"int32","description":"The number of downloads for this version on the given date.","example":123},"version":{"type":"integer","format":"int32","description":"The ID of the version this download count is for.","example":42}}},"VersionLinks":{"type":"object","required":["dependencies","version_downloads","authors"],"properties":{"authors":{"type":"string","description":"The API path to download this version's authors.","deprecated":true,"example":"/api/v1/crates/serde/1.0.0/authors"},"dependencies":{"type":"string","description":"The API path to download this version's dependencies.","example":"/api/v1/crates/serde/1.0.0/dependencies"},"version_downloads":{"type":"string","description":"The API path to download this version's download numbers.","example":"/api/v1/crates/serde/1.0.0/downloads"}}}},"securitySchemes":{"api_token":{"type":"apiKey","in":"header","name":"authorization","description":"The API token is used to authenticate requests from cargo and other clients."},"cookie":{"type":"apiKey","in":"cookie","name":"cargo_session","description":"The session cookie is used by the web UI to authenticate users."},"trustpub_token":{"type":"http","scheme":"bearer","description":"Temporary access tokens are used by the \"Trusted Publishing\" flow."}}}}