# Verify API Key Policy Error with Path Parameter

**URL:** <https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703>\
**Category:** Apigee\
**Tags:** api-runtime\
**Created:** [October 11, 2020, 12:38pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703 "2020-10-11T12:38:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 11, 2020, 12:38pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/1 "2020-10-11T12:38:02Z")

</div>

Hi,

I have an API Proxy with below resources with Verify API Key policy.

(1) - /salesOrder

(2) - /salesOrder/{orderID}/Header

(3) - /salesOrder/{orderID}/Items

I created a API Product with adding the API Proxy with all 3 resources. In runtime I’m able to successful call (1), but (2) and (3) result error “Invalid ApiKey for given resource”.

The same key works when I updated the API Resource (2) and (3) as /salesOrder/Header/{orderID} and /salesOrder/Items/{orderID} i.e. with path Parameter at the end.

Question: Is there a limitation to determine the exact resource when path parameter is used in URI segments inbetween?

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 11, 2020, 1:15pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/2 "2020-10-11T13:15:34Z")

</div>

please try below and let me know.

(2) /salesOrder/\*/Header

(3) -/salesOrder/\*/Items

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 12, 2020, 9:24am UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/3 "2020-10-12T09:24:49Z")

</div>

No. It’s the same result “Invalid ApiKey for given resource”.

If I disable the policy I see that the respective Resource’s Conditional Flow is triggered. But the same resource is not recognized during verify api key step to successfully validate the key.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 12, 2020, 10:13am UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/4 "2020-10-12T10:13:16Z")

</div>

in that case please remove all the resource paths present in the product.

only simply add the proxy name. You will not see the error.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 12, 2020, 10:36pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/5 "2020-10-12T22:36:02Z")

</div>

@santhosh kumar vellingiri, it might help you to check [https://docs.apigee.com/api-platform/publish/create-api-products#behavior-resource-path](https://docs.apigee.com/api-platform/publish/create-api-products#behavior-resource-path)

on how to use the wildcards to satisfy the resources you have.

---

<div class="post-metadata">

**Author:** ![dchiesa1](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/dchiesa1/32/15641_2.png) [@dchiesa1](https://discuss.google.dev/u/dchiesa1)\
**Post date:** [October 13, 2020, 3:05pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/6 "2020-10-13T15:05:28Z")

</div>

Is there a limitation to determine the exact resource when path parameter is used in URI segments inbetween?

I don’t quite understand what you’re asking.

But I can give you some information that might help. When you configure an API product, you get to specify the resource paths that are included in the authorization. A Common choice is “/\*\*” which indicates “all paths are included”.

If you specify the resource path as “/\*” , that tells Apigee to limit the API calls to only those with ONE path segment. It does not matter if the path segment is variable or not.

If you specify the resource path as / (a single slash) , then it tells Apigee that only an API call with the basepath will be allowed.

All of this is documented. [https://docs.apigee.com/api-platform/publish/create-api-products#behavior-resource-path](https://docs.apigee.com/api-platform/publish/create-api-products#behavior-resource-path)

So I suspect that you have a resource path configured on your API product, and that is what is causing the “invalid APIKey for given resource” .

If you remove all resourcepaths on the API Product, then Apigee reverts to “/\*\*” which means “any path is allowed.”

If you like, you can just create a NEW api product with new credentials and try it that way.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 14, 2020, 2:24pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/7 "2020-10-14T14:24:57Z")

</div>

Thank you. I was stuck with it not working with the API resource added to the product. Now I have the product with only API Proxy and it’s working.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [October 14, 2020, 2:25pm UTC](https://discuss.google.dev/t/verify-api-key-policy-error-with-path-parameter/3703/8 "2020-10-14T14:25:10Z")

</div>

Thank you. I was stuck with it not working with the API resource added to the product. Now I have the product with only API Proxy and it’s working.
