πPin CID
A user can create an additional copy of your file in the IPFS network or migrate a file to the Lighthouse IPFS node pinning service can be used.
A POST request has to be made with cid(required) and fileName(optional) parameters. API key is required for authentication.
curl -X POST -H 'Authorization: Bearer API_KEY' -H "Content-Type: application/json" -d '{"cid": "QmWC9AkGa6vSbR4yizoJrFMfmZh4XjZXxvRDknk2LdJffc","fileName": "abc.png"}' https://api.lighthouse.storage/api/lighthouse/pinimport requests
from lighthouseweb3 import Lighthouse
lh = Lighthouse(token="YOUR_API_KEY")
cid = "QmWC9AkGa6vSbR4yizoJrFMfmZh4XjZXxvRDknk2LdJffc"
fileName = "abc.png" # Optional
url = "https://api.lighthouse.storage/api/lighthouse/pin"
headers = {
"Authorization": f"Bearer {lh.token}",
"Content-Type": "application/json"
}
data = {
"cid": cid,
"fileName": fileName
}
response = requests.post(url, json=data, headers=headers)
response.raise_for_status()
result = response.json()
print(result)Last updated
Was this helpful?