How do pin data using the Infura's API?

[nfura indicates that “Data is currently pinned until it’s been 6 months since it was last used”. Their documentation shows the request pin data to be in the following format:

curl -X POST `https://ipfs.infura.io:5001/api/v0/pin/add?arg=&progress="

I’m currently using JavaScript’s API ipfs-http-client to make Http calls.

The add function from the source code doesn’t seem to provide a way to indicate pinning:

module.exports = (options) => {
  const all = addAll(options)

  return configure(() => {
    return async function add (path, options = {}) { // eslint-disable-line require-await
      return last(all({
        path,
        ...options
      }, options))
    }
  })(options)
}

How do I pin data using this JavaScript API?

I’m currently making the Http request as following:

const ipfs = ipfsClient({
  host: "ipfs.infura.io",
  port: 5001,
  protocol: "https",
});

try {
  const added = await ipfs.add(data)
} catch (err) {
  // handle error
}

If infura is using the normal gateway code, and not altering it then the “add” does an automatic pin, so you don’t need call ‘pin’ after the add.

Search for ‘pin’ on this page…

you’d probably only need to call pin directly if you want to pin something already existing as an available CID.

So infura is pinning files for free & forever?