Browse Index returning error: Method not allowed with this API key

I’m writing a Swift app and am getting an error when I try to browse an index. I’m trying to return all records that match a filter, instead of being limited by 20.

My initial request worked (but limited me to 20). When I updated it to a browse call, per the api docs. I get an error response: “Method not allowed with this API key”

Is this a restriction of the Community plan?

The query causing the issue:

let query = Query(query: "") 
query.filters = "city:seattle"
index.browse(query: query, completionHandler: { (content, error) -> Void in
    if error == nil {
        print("Result: \(content!)")
    }
})

My initial query was working fine (except for only returning 20 items):

let query = Query(query: "") 
query.filters = "city:seattle"
index.search(query, completionHandler: { (content, error) -> Void in
    if error == nil {
        print("Result: \(content!)")
    }
})

Hi @tyler,

Thanks for contacting us!

As mentioned above, the API key that you are using doesn’t have the right permissions to browse an access, and can only search. We specify in the docs the different permissions that you can give to your API key.

So to solve your issue, you should go to your dashboard, Then Api Keys -> All Api Keys and then edit the api key to add the browse index ACL

Thanks @guy.daher - that did the trick!

2 Likes