Pinata with ipfs-http-client

I am trying to use ipfs-http-client with pinata, but it seems impossible.

const ipfs = create({
    host: 'api.pinata.cloud',
    port: 80,
    protocol: 'https',
    apiPath: '',
    headers: {
      authorization: 'Bearer ' + 'JWT HERE'
    }
})
 await ipfs.add("nice");

This just results in connection timed out. The reason is that it makes a request to https://api.pinata.cloud:80/api/v0/add?stream-channels=true&progress=false which seems wrong as pinata won’t have that /api/v0/add in the endpoint.

If I try to set apiPath setting while creating ipfs-http-client, It poses 2 problems.

  1. If I am using multiple pinata endpoints, I have to create ipfs-http-client multiple times for different apiPath.
  2. It again still doesn’t work. I tried setting apiPath: 'pinning/pinByHash', , but now it makes a request to https://api.pinata.cloud:80/api/v0/add?stream-channels=true&progress=false. So add is still in there in the url…

Doesn’t ipfs-http-client work with Pinata ?

I know Pinata has a proprietary http API, but do they also expose a normal IPFS gateway that simply requires the auth token (Bearer) and then exposes IPFS API itself ? Where did you see this on their website, and do they have an examples of this on their website? It seems like if they support it they would have an example of it being done (actual code).

1 Like