Search code examples
postman

How to pass an API key while create a data in post request


I put this code in my body

{
  "contact": {
    "project_id": 1,
    "first_name": "John",
    "address_attributes": {"street1": "12, Street", "city": "Moscow", "country_code": "RU"},
    "tag_list": "vip,cold call" 
  }
}

I tried to put an API key in param and header also respectively but every time it gives me "403:forbidden" error Any help will be grateful.


Solution

  • You would need to check the API documentation to know how the API keys are to be passed in.

    In many cases (not sure if most), this is done by passing it in as an header, usually the Authorization headers.

    Most APIs that use this technique require you to add it by adding the header key as Authorization and its value as 'Bearer {API_KEY}' where {API_KEY} represents the api-key you aim to send.