File size: 41,882 Bytes
f4bd24d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 | {
"openapi": "3.0.0",
"info": {
"title": "Context7 Public API",
"description": "The Context7 Public API provides programmatic access to library documentation and search functionality. Get up-to-date documentation and code examples for any library.",
"version": "2.0.0",
"contact": {
"name": "Context7 Support",
"url": "https://context7.com",
"email": "support@context7.com"
}
},
"servers": [
{
"url": "https://context7.com/api",
"description": "Production server"
}
],
"paths": {
"/v2/docs/code/{owner}/{repo}": {
"get": {
"summary": "Get code snippets for a library",
"description": "Retrieves paginated code examples and API snippets from a library's documentation. Supports filtering by topic and returns results in JSON or text format.",
"operationId": "getCodeSnippets",
"tags": ["Retrieve Documentation"],
"parameters": [
{
"$ref": "#/components/parameters/OwnerParam"
},
{
"$ref": "#/components/parameters/RepoParam"
},
{
"$ref": "#/components/parameters/TopicParam"
},
{
"$ref": "#/components/parameters/TypeParam"
},
{
"$ref": "#/components/parameters/PageParam"
},
{
"$ref": "#/components/parameters/LimitParam"
}
],
"responses": {
"200": {
"$ref": "#/components/responses/CodeSnippetsJsonResponse"
},
"400": {
"$ref": "#/components/responses/BadRequestError"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"404": {
"$ref": "#/components/responses/NotFoundError"
},
"202": {
"$ref": "#/components/responses/AcceptedError"
},
"301": {
"$ref": "#/components/responses/RedirectError"
},
"403": {
"$ref": "#/components/responses/ForbiddenError"
},
"422": {
"$ref": "#/components/responses/UnprocessableEntityError"
},
"429": {
"$ref": "#/components/responses/RateLimitError"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
},
"security": [
{},
{
"bearerAuth": []
}
]
}
},
"/v2/docs/code/{owner}/{repo}/{version}": {
"get": {
"summary": "Get code snippets for a specific library version",
"description": "Retrieves paginated code examples and API snippets from a specific version (tag or branch) of a library's documentation.",
"operationId": "getCodeSnippetsByVersion",
"tags": ["Retrieve Documentation"],
"parameters": [
{
"$ref": "#/components/parameters/OwnerParam"
},
{
"$ref": "#/components/parameters/RepoParam"
},
{
"$ref": "#/components/parameters/VersionParam"
},
{
"$ref": "#/components/parameters/TopicParam"
},
{
"$ref": "#/components/parameters/TypeParam"
},
{
"$ref": "#/components/parameters/PageParam"
},
{
"$ref": "#/components/parameters/LimitParam"
}
],
"responses": {
"200": {
"$ref": "#/components/responses/CodeSnippetsJsonResponse"
},
"400": {
"$ref": "#/components/responses/BadRequestError"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"404": {
"$ref": "#/components/responses/NotFoundError"
},
"202": {
"$ref": "#/components/responses/AcceptedError"
},
"301": {
"$ref": "#/components/responses/RedirectError"
},
"403": {
"$ref": "#/components/responses/ForbiddenError"
},
"422": {
"$ref": "#/components/responses/UnprocessableEntityError"
},
"429": {
"$ref": "#/components/responses/RateLimitError"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
},
"security": [
{},
{
"bearerAuth": []
}
]
}
},
"/v2/docs/info/{owner}/{repo}": {
"get": {
"summary": "Get documentation content for a library",
"description": "Retrieves paginated informational documentation snippets from a library. Supports filtering by topic and returns results in JSON or text format.",
"operationId": "getInfoSnippets",
"tags": ["Retrieve Documentation"],
"parameters": [
{
"$ref": "#/components/parameters/OwnerParam"
},
{
"$ref": "#/components/parameters/RepoParam"
},
{
"$ref": "#/components/parameters/TopicParam"
},
{
"$ref": "#/components/parameters/TypeParam"
},
{
"$ref": "#/components/parameters/PageParam"
},
{
"$ref": "#/components/parameters/LimitParam"
}
],
"responses": {
"200": {
"$ref": "#/components/responses/InfoSnippetsJsonResponse"
},
"400": {
"$ref": "#/components/responses/BadRequestError"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"404": {
"$ref": "#/components/responses/NotFoundError"
},
"202": {
"$ref": "#/components/responses/AcceptedError"
},
"301": {
"$ref": "#/components/responses/RedirectError"
},
"403": {
"$ref": "#/components/responses/ForbiddenError"
},
"422": {
"$ref": "#/components/responses/UnprocessableEntityError"
},
"429": {
"$ref": "#/components/responses/RateLimitError"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
},
"security": [
{},
{
"bearerAuth": []
}
]
}
},
"/v2/docs/info/{owner}/{repo}/{version}": {
"get": {
"summary": "Get documentation content for a specific library version",
"description": "Retrieves paginated informational documentation snippets from a specific version (tag or branch) of a library.",
"operationId": "getInfoSnippetsByVersion",
"tags": ["Retrieve Documentation"],
"parameters": [
{
"$ref": "#/components/parameters/OwnerParam"
},
{
"$ref": "#/components/parameters/RepoParam"
},
{
"$ref": "#/components/parameters/VersionParam"
},
{
"$ref": "#/components/parameters/TopicParam"
},
{
"$ref": "#/components/parameters/TypeParam"
},
{
"$ref": "#/components/parameters/PageParam"
},
{
"$ref": "#/components/parameters/LimitParam"
}
],
"responses": {
"200": {
"$ref": "#/components/responses/InfoSnippetsJsonResponse"
},
"400": {
"$ref": "#/components/responses/BadRequestError"
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"404": {
"$ref": "#/components/responses/NotFoundError"
},
"202": {
"$ref": "#/components/responses/AcceptedError"
},
"301": {
"$ref": "#/components/responses/RedirectError"
},
"403": {
"$ref": "#/components/responses/ForbiddenError"
},
"422": {
"$ref": "#/components/responses/UnprocessableEntityError"
},
"429": {
"$ref": "#/components/responses/RateLimitError"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
},
"security": [
{},
{
"bearerAuth": []
}
]
}
},
"/v2/search": {
"get": {
"summary": "Search for libraries",
"description": "Search across available libraries. Returns finalized public libraries and accessible private repositories based on authentication.",
"operationId": "searchLibraries",
"tags": ["Search Libraries"],
"parameters": [
{
"name": "query",
"in": "query",
"description": "Search query string. Returns empty results if not provided.",
"required": false,
"schema": {
"type": "string",
"maxLength": 500
},
"example": "react hooks"
}
],
"responses": {
"200": {
"description": "Successful search response",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Search results response",
"properties": {
"results": {
"type": "array",
"description": "Array of matching libraries",
"items": {
"$ref": "#/components/schemas/Library"
}
},
"metadata": {
"$ref": "#/components/schemas/APIResponseMetadata"
}
},
"required": ["results", "metadata"]
},
"examples": {
"withResults": {
"summary": "Search with results",
"value": {
"results": [
{
"id": "/vercel/next.js",
"title": "Next.js",
"description": "Next.js enables you to create full-stack web applications by extending the latest React features and integrating powerful Rust-based JavaScript tooling for the fastest builds.",
"branch": "canary",
"lastUpdateDate": "2025-11-17T22:20:15.784Z",
"state": "finalized",
"totalTokens": 824953,
"totalSnippets": 3336,
"stars": 131745,
"trustScore": 10,
"benchmarkScore": 91.1,
"versions": [
"v14.3.0-canary.87",
"v13.5.11",
"v15.1.8",
"v15.4.0-canary.82",
"v12.3.7",
"v11.1.3"
]
}
],
"metadata": {
"authentication": "none"
}
}
},
"emptyQuery": {
"summary": "Empty query returns no results",
"value": {
"results": [],
"metadata": {
"authentication": "none"
}
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"429": {
"$ref": "#/components/responses/RateLimitError"
},
"500": {
"$ref": "#/components/responses/InternalServerError"
}
},
"security": [
{},
{
"bearerAuth": []
}
]
}
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"description": "Get your API key at [context7.com/dashboard](https://context7.com/dashboard). Treat your API key like a password and store it securely."
}
},
"parameters": {
"OwnerParam": {
"name": "owner",
"in": "path",
"description": "Repository owner - GitHub username or organization name (case-insensitive)",
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"example": "vercel"
},
"RepoParam": {
"name": "repo",
"in": "path",
"description": "Repository name (case-insensitive)",
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"example": "next.js"
},
"VersionParam": {
"name": "version",
"in": "path",
"description": "Specific version (tag or branch) of the library",
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 500
},
"example": "v14.0.0"
},
"TopicParam": {
"name": "topic",
"in": "query",
"description": "Filter snippets by topic or search term",
"required": false,
"schema": {
"type": "string",
"maxLength": 500
},
"example": "authentication"
},
"TypeParam": {
"name": "type",
"in": "query",
"description": "Response format type",
"required": false,
"schema": {
"type": "string",
"enum": ["json", "txt"],
"default": "txt"
},
"example": "json"
},
"PageParam": {
"name": "page",
"in": "query",
"description": "Page number for pagination (1-indexed). Maximum 10 pages accessible for each topic.",
"required": false,
"schema": {
"type": "integer",
"minimum": 1,
"default": 1
},
"example": 1
},
"LimitParam": {
"name": "limit",
"in": "query",
"description": "Number of items per page",
"required": false,
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 10
},
"example": 10
}
},
"schemas": {
"CodeSnippet": {
"type": "object",
"description": "A code snippet from library documentation",
"properties": {
"codeTitle": {
"type": "string",
"description": "Title of the code snippet"
},
"codeDescription": {
"type": "string",
"description": "Description of what the code does"
},
"codeLanguage": {
"type": "string",
"description": "Primary programming language of the snippet"
},
"codeTokens": {
"type": "integer",
"description": "Token count for the snippet"
},
"codeId": {
"type": "string",
"description": "Unique identifier for the code snippet"
},
"pageTitle": {
"type": "string",
"description": "Title of the documentation page containing this snippet"
},
"codeList": {
"type": "array",
"description": "List of code examples in different languages",
"items": {
"$ref": "#/components/schemas/CodeExample"
}
}
},
"required": [
"codeTitle",
"codeDescription",
"codeLanguage",
"codeTokens",
"codeId",
"pageTitle",
"codeList"
]
},
"CodeExample": {
"type": "object",
"description": "A single code example",
"properties": {
"language": {
"type": "string",
"description": "Programming language of this code example"
},
"code": {
"type": "string",
"description": "The actual code content"
}
},
"required": ["language", "code"]
},
"InfoSnippet": {
"type": "object",
"description": "A documentation/info snippet from library",
"properties": {
"pageId": {
"type": "string",
"description": "Unique page identifier"
},
"breadcrumb": {
"type": "string",
"description": "Navigation breadcrumb path"
},
"content": {
"type": "string",
"description": "The documentation content"
},
"contentTokens": {
"type": "integer",
"description": "Token count for the content"
}
},
"required": ["content", "contentTokens"]
},
"Pagination": {
"type": "object",
"description": "Pagination metadata",
"properties": {
"page": {
"type": "integer",
"description": "Current page number (1-indexed)",
"minimum": 1
},
"limit": {
"type": "integer",
"description": "Items per page",
"minimum": 1,
"maximum": 10
},
"totalPages": {
"type": "integer",
"description": "Total number of pages available for a topic",
"minimum": 0
},
"hasNext": {
"type": "boolean",
"description": "Whether a next page exists"
},
"hasPrev": {
"type": "boolean",
"description": "Whether a previous page exists"
}
},
"required": ["page", "limit", "totalPages", "hasNext", "hasPrev"]
},
"APIResponseMetadata": {
"type": "object",
"description": "Response metadata",
"properties": {
"authentication": {
"type": "string",
"enum": ["none", "personal", "team"],
"description": "Authentication type used for this request"
}
},
"required": ["authentication"]
},
"Library": {
"type": "object",
"description": "Library metadata",
"properties": {
"id": {
"type": "string",
"description": "Library ID in format `/owner/repo`",
"example": "/vercel/next.js"
},
"title": {
"type": "string",
"description": "Display name of the library",
"example": "Next.js"
},
"description": {
"type": "string",
"description": "Short description",
"example": "The React Framework"
},
"branch": {
"type": "string",
"description": "Git branch being tracked",
"example": "canary"
},
"lastUpdateDate": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp of last update",
"example": "2025-07-27T06:56:26.691Z"
},
"state": {
"type": "string",
"enum": ["finalized", "initial", "processing", "error", "delete"],
"description": "Processing state of the library",
"example": "finalized"
},
"totalTokens": {
"type": "integer",
"description": "Total tokens in documentation",
"example": 607822
},
"totalSnippets": {
"type": "integer",
"description": "Number of code snippets",
"example": 3629
},
"stars": {
"type": "integer",
"description": "GitHub stars count",
"example": 131745
},
"trustScore": {
"type": "integer",
"description": "Source reputation score (0-10, used internally to determine High/Medium/Low/Unknown reputation)",
"minimum": 0,
"maximum": 10,
"example": 10
},
"benchmarkScore": {
"type": "number",
"description": "Quality indicator score (0-100, with 100 being the highest quality)",
"minimum": 0,
"maximum": 100,
"example": 95.5
},
"versions": {
"type": "array",
"description": "Available version tags",
"items": {
"type": "string"
},
"example": ["v15.1.8", "v14.3.0-canary.87"]
}
}
},
"Error": {
"type": "object",
"properties": {
"error": {
"type": "string",
"description": "Error code identifier"
},
"message": {
"type": "string",
"description": "Human-readable error message"
},
"status": {
"type": "integer",
"description": "HTTP status code"
}
},
"required": ["error"]
},
"ValidationError": {
"allOf": [
{
"$ref": "#/components/schemas/Error"
},
{
"type": "object",
"properties": {
"maxLimit": {
"type": "integer",
"description": "Maximum allowed limit value (only present for limit exceeded errors)"
},
"redirectUrl": {
"type": "string",
"description": "New location of the library (only present for redirect errors)"
}
}
}
]
}
},
"headers": {
"X-Context7-Page": {
"description": "Current page number (1-indexed). Only returned for text/plain responses (type=txt).",
"schema": {
"type": "integer",
"minimum": 1
},
"example": 1
},
"X-Context7-Limit": {
"description": "Number of items per page. Only returned for text/plain responses (type=txt).",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"example": 10
},
"X-Context7-Total-Pages": {
"description": "Total number of pages available. Only returned for text/plain responses (type=txt).",
"schema": {
"type": "integer",
"minimum": 0
},
"example": 10
},
"X-Context7-Has-Next": {
"description": "Whether a next page exists. Only returned for text/plain responses (type=txt).",
"schema": {
"type": "string",
"enum": ["true", "false"]
},
"example": "true"
},
"X-Context7-Has-Prev": {
"description": "Whether a previous page exists. Only returned for text/plain responses (type=txt).",
"schema": {
"type": "string",
"enum": ["true", "false"]
},
"example": "false"
},
"X-Context7-Total-Tokens": {
"description": "Total token count for the current page. Only returned for text/plain responses (type=txt).",
"schema": {
"type": "integer",
"minimum": 0
},
"example": 1500
}
},
"responses": {
"CodeSnippetsJsonResponse": {
"description": "Successful response with code snippets",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Response containing code snippets",
"properties": {
"snippets": {
"type": "array",
"description": "Array of code snippets",
"items": {
"$ref": "#/components/schemas/CodeSnippet"
}
},
"totalTokens": {
"type": "integer",
"description": "Total token count for all returned snippets"
},
"pagination": {
"$ref": "#/components/schemas/Pagination"
},
"metadata": {
"$ref": "#/components/schemas/APIResponseMetadata"
}
},
"required": ["snippets", "totalTokens", "pagination", "metadata"]
},
"example": {
"snippets": [
{
"codeTitle": "Create and Run Next.js App with create-next-app (Quick Start)",
"codeDescription": "Quickly set up and start a new Next.js application using `create-next-app` with various package managers. This command creates a new project directory, installs dependencies, and starts the development server. The `--yes` flag skips interactive prompts, enabling a default setup with TypeScript, Tailwind, ESLint, App Router, and Turbopack.",
"codeLanguage": "bash",
"codeTokens": 185,
"codeId": "https://github.com/vercel/next.js/blob/canary/docs/01-app/01-getting-started/01-installation.mdx#_snippet_0",
"pageTitle": "Installation",
"codeList": [
{
"language": "bash",
"code": "pnpm create next-app@latest my-app --yes\ncd my-app\npnpm dev"
},
{
"language": "bash",
"code": "npx create-next-app@latest my-app --yes\ncd my-app\nnpm run dev"
},
{
"language": "bash",
"code": "yarn create next-app@latest my-app --yes\ncd my-app\nyarn dev"
},
{
"language": "bash",
"code": "bun create next-app@latest my-app --yes\ncd my-app\nbun dev"
}
]
}
],
"totalTokens": 185,
"pagination": {
"page": 1,
"limit": 10,
"totalPages": 10,
"hasNext": true,
"hasPrev": false
},
"metadata": {
"authentication": "none"
}
}
},
"text/plain": {
"schema": {
"type": "string",
"description": "Plain text formatted documentation. Pagination metadata is returned via response headers."
},
"example": "### Create and Run Next.js App with create-next-app (Quick Start)\n\nSource: https://github.com/vercel/next.js/blob/canary/docs/01-app/01-getting-started/01-installation.mdx\n\nQuickly set up and start a new Next.js application using `create-next-app` with various package managers. This command creates a new project directory, installs dependencies, and starts the development server. The `--yes` flag skips interactive prompts, enabling a default setup with TypeScript, Tailwind, ESLint, App Router, and Turbopack.\n\n```bash\npnpm create next-app@latest my-app --yes\ncd my-app\npnpm dev\n```\n\n```bash\nnpx create-next-app@latest my-app --yes\ncd my-app\nnpm run dev\n```\n\n```bash\nyarn create next-app@latest my-app --yes\ncd my-app\nyarn dev\n```\n\n```bash\nbun create next-app@latest my-app --yes\ncd my-app\nbun dev\n```"
}
},
"headers": {
"X-Context7-Page": {
"$ref": "#/components/headers/X-Context7-Page"
},
"X-Context7-Limit": {
"$ref": "#/components/headers/X-Context7-Limit"
},
"X-Context7-Total-Pages": {
"$ref": "#/components/headers/X-Context7-Total-Pages"
},
"X-Context7-Has-Next": {
"$ref": "#/components/headers/X-Context7-Has-Next"
},
"X-Context7-Has-Prev": {
"$ref": "#/components/headers/X-Context7-Has-Prev"
},
"X-Context7-Total-Tokens": {
"$ref": "#/components/headers/X-Context7-Total-Tokens"
}
}
},
"InfoSnippetsJsonResponse": {
"description": "Successful response with info/documentation snippets",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Response containing info/documentation snippets",
"properties": {
"snippets": {
"type": "array",
"description": "Array of info snippets",
"items": {
"$ref": "#/components/schemas/InfoSnippet"
}
},
"totalTokens": {
"type": "integer",
"description": "Total token count for all returned snippets"
},
"pagination": {
"$ref": "#/components/schemas/Pagination"
},
"metadata": {
"$ref": "#/components/schemas/APIResponseMetadata"
}
},
"required": ["snippets", "totalTokens", "pagination", "metadata"]
},
"example": {
"snippets": [
{
"pageId": "https://github.com/vercel/next.js/blob/canary/docs/04-community/01-contribution-guide.mdx",
"breadcrumb": "How to Contribute > Writing MDX",
"content": "The docs are written in [MDX](https://mdxjs.com/), a markdown format that supports JSX syntax. This allows us to embed React components in the docs. See the [GitHub Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for a quick overview of markdown syntax.",
"contentTokens": 84
}
],
"totalTokens": 84,
"pagination": {
"page": 1,
"limit": 10,
"totalPages": 10,
"hasNext": true,
"hasPrev": false
},
"metadata": {
"authentication": "none"
}
}
},
"text/plain": {
"schema": {
"type": "string",
"description": "Plain text formatted documentation. Pagination metadata is returned via response headers."
},
"example": "### How to Contribute > Writing MDX\n\nSource: https://github.com/vercel/next.js/blob/canary/docs/04-community/01-contribution-guide.mdx\n\nThe docs are written in [MDX](https://mdxjs.com/), a markdown format that supports JSX syntax. This allows us to embed React components in the docs. See the [GitHub Markdown Guide](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for a quick overview of markdown syntax."
}
},
"headers": {
"X-Context7-Page": {
"$ref": "#/components/headers/X-Context7-Page"
},
"X-Context7-Limit": {
"$ref": "#/components/headers/X-Context7-Limit"
},
"X-Context7-Total-Pages": {
"$ref": "#/components/headers/X-Context7-Total-Pages"
},
"X-Context7-Has-Next": {
"$ref": "#/components/headers/X-Context7-Has-Next"
},
"X-Context7-Has-Prev": {
"$ref": "#/components/headers/X-Context7-Has-Prev"
},
"X-Context7-Total-Tokens": {
"$ref": "#/components/headers/X-Context7-Total-Tokens"
}
}
},
"BadRequestError": {
"description": "Bad Request - Invalid input parameters",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationError"
},
"examples": {
"invalidInput": {
"summary": "Multiple source parameters provided",
"value": {
"error": "invalid_input",
"message": "Provide exactly one of: docsRepoUrl or llmstxtUrl",
"status": 400
}
},
"invalidFormat": {
"summary": "Invalid library format (v2 endpoints)",
"value": {
"error": "invalid_format",
"message": "Invalid library format. Expected: owner/repo[/version]"
}
},
"invalidLength": {
"summary": "Invalid parameter length",
"value": {
"error": "invalid_length",
"message": "Invalid owner or repo name. Must be 1-500 characters."
}
},
"invalidType": {
"summary": "Invalid type parameter",
"value": {
"error": "invalid_type",
"message": "Invalid type parameter. Supported values: json, txt"
}
},
"invalidPage": {
"summary": "Invalid page number",
"value": {
"error": "invalid_page",
"message": "Invalid page number. Must be a positive integer."
}
},
"invalidLimit": {
"summary": "Limit exceeds maximum",
"value": {
"error": "invalid_limit",
"message": "Items per page exceeds maximum allowed (10)",
"maxLimit": 10
}
},
"invalidLlmstxtUrl": {
"summary": "Invalid llms.txt URL",
"value": {
"error": "invalid_llmstxt_url",
"message": "llmstxtUrl must end with llms.txt, llms-full.txt, or llms-small.txt",
"status": 400
}
}
}
}
}
},
"UnauthorizedError": {
"description": "Unauthorized - Invalid or missing API key, or access denied",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"invalidApiKey": {
"summary": "Invalid API key",
"value": {
"error": "invalid_api_key",
"message": "Invalid or expired API key",
"status": 401
}
},
"accessDenied": {
"summary": "Access denied to library",
"value": {
"error": "access_denied",
"message": "Access denied: Library /vercel/next.js is not included in your allowed libraries"
}
},
"authenticationFailed": {
"summary": "Authentication failed",
"value": {
"error": "authentication_failed",
"message": "Failed to authenticate API key",
"status": 401
}
}
}
}
}
},
"ForbiddenError": {
"description": "Forbidden - Insufficient permissions or blocked library",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"insufficientPermissions": {
"summary": "Insufficient permissions",
"value": {
"error": "insufficient_permissions",
"message": "Insufficient permissions",
"status": 403
}
},
"libraryBlocked": {
"summary": "Library has been blocked",
"value": {
"error": "library_blocked",
"message": "Library /owner/repo has been blocked by system."
}
}
}
}
}
},
"NotFoundError": {
"description": "Not Found - Library, project, or resource doesn't exist",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"libraryNotFound": {
"summary": "Library not found",
"value": {
"error": "library_not_found",
"message": "Library /owner/repo not found. You can add it at context7.com/add-library",
"status": 404
}
},
"tagNotFound": {
"summary": "Version/tag not found",
"value": {
"error": "tag_not_found",
"message": "Tag 'v1.0.0' not found for library /owner/repo"
}
}
}
}
}
},
"AcceptedError": {
"description": "Accepted - Library not yet finalized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"example": {
"error": "library_not_finalized",
"message": "Library /owner/repo not finalized yet."
}
}
}
},
"RedirectError": {
"description": "Moved Permanently - Library has been redirected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ValidationError"
},
"example": {
"error": "library_redirected",
"message": "Library /owner/repo has been redirected to this library: /new-owner/new-repo.",
"redirectUrl": "/new-owner/new-repo"
}
}
}
},
"UnprocessableEntityError": {
"description": "Unprocessable Entity - Library is too large or has no code",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"tooLarge": {
"summary": "Library too large",
"value": {
"error": "library_too_large",
"message": "Library /owner/repo is too large to process."
}
},
"noCode": {
"summary": "No code found",
"value": {
"error": "no_code_found",
"message": "Library /owner/repo has no or too few snippets found in documentation files."
}
}
}
}
}
},
"RateLimitError": {
"description": "Too Many Requests - Rate limit exceeded",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"example": {
"error": "Too many requests",
"status": 429
}
}
}
},
"InternalServerError": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
},
"examples": {
"generic": {
"summary": "Generic internal error",
"value": {
"error": "internal_server_error",
"message": "An internal error occurred while processing your request.",
"status": 500
}
},
"serverConfiguration": {
"summary": "Server configuration error",
"value": {
"error": "server_configuration",
"message": "Server configuration error",
"status": 500
}
},
"databaseError": {
"summary": "Database operation failed",
"value": {
"error": "database_error",
"message": "Failed to save private repository",
"status": 500
}
},
"processingFailed": {
"summary": "Library processing failed",
"value": {
"error": "processing_failed",
"message": "Failed to process library",
"status": 500
}
}
}
}
}
}
}
},
"tags": [
{
"name": "Retrieve Documentation",
"description": "Retrieve library documentation and code examples"
},
{
"name": "Search Libraries",
"description": "Search for libraries in the Context7 database"
}
]
}
|