You can use a curl command to verify your setup.
You can pass the API key either in the URL:
PALM_KEY="YOUR KEY HERE"curl-H'Content-Type: application/json'\-d'{"prompt": {text: "Give me five subcategories of jazz"} }'\"https://generativelanguage.googleapis.com/v1/models/text-bison-001:generateText?key=${PALM_KEY}"
Or in the x-goog-api-key header:
PALM_KEY="YOUR KEY HERE"curl-H'Content-Type: application/json'\-H"x-goog-api-key: ${PALM_KEY}"\-d'{"prompt": {text: "Give me five subcategories of jazz"} }'\"https://generativelanguage.googleapis.com/v1/models/text-bison-001:generateText"
Next steps
Follow any of the API quickstarts to start using your
API key.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-11 UTC."],[],[],null,["# Get an API key\n\n\u003cbr /\u003e\n\nTo use the API, you need an API key.\nYou can create a key with one click in MakerSuite.\n\n[Get an API key](https://makersuite.google.com/app/apikey)\n| **Note:** Remember to use your API keys securely. Check out this [support\n| article](https://support.google.com/googleapi/answer/6310037) to learn best practices.\n\nVerify your API key with curl command\n-------------------------------------\n\nYou can use a curl command to verify your setup.\nYou can pass the API key either in the URL: \n\n PALM_KEY=\"YOUR KEY HERE\"\n curl -H 'Content-Type: application/json' \\\n -d '{\"prompt\": {text: \"Give me five subcategories of jazz\"} }' \\\n \"https://generativelanguage.googleapis.com/v1/models/text-bison-001:generateText?key=${PALM_KEY}\"\n\nOr in the `x-goog-api-key` header: \n\n PALM_KEY=\"YOUR KEY HERE\"\n curl -H 'Content-Type: application/json' \\\n -H \"x-goog-api-key: ${PALM_KEY}\" \\\n -d '{\"prompt\": {text: \"Give me five subcategories of jazz\"} }' \\\n \"https://generativelanguage.googleapis.com/v1/models/text-bison-001:generateText\"\n\nNext steps\n----------\n\n- Follow any of the [API quickstarts](/palm_docs/chat_quickstart) to start using your API key.\n- For more information about using Google API keys refer to [Authenticate using API keys](https://cloud.google.com/docs/authentication/api-keys)"]]