ApiKeys

ApiKeys

Generate W3IPFS API key

This endpoint is used to programmatically generate W3IPFS API keys. This endpoint can only be called by using an "Admin" key. When generating new keys, specific scopes and limits can be implemented.

Make sure to record the API Secret as they will not be accessible again.

The request body when generating a W3IPFS API key will look like this:

{
    "name": "(A name for your new key for easy reference - Required)",
    "scopes": {
        "admin": boolean,
        "data": {
            "pin_list": boolean,
            "nft_list": boolean
        },
        "pinning": {
            "unpin": boolean,
            "pin_by_hash": boolean,
            "pin_file_to_ipfs": boolean
        },
        "pin_nft":{
            "unpin_nft": boolean,
            "pin_nft_to_ipfs": boolean
        }
    }
}

Notice the name is required. When setting the permissions, it is necessary to include all properties and sub-properties unless you are creating an admin key. If you are creating an admin key, the sub-properties can be omitted.

For example, this would be a simplified body for admin key generation:

{
    "name": "Admin api key",
    "scopes": {
        "admin": true
    }
}
POSThttps://api.w3ipfs.aioz.network/api/apiKeys

Headers

Authorization* Bearer your_access_token_here

Body

name*
scopes

Response

200: OK
{
    "data": {
        "name": "API KEY",
        "api_key": "KEY",
        "secret_key": "SECRET"
    },
    "status": "success"
}
curl --location --request POST 'https://api.w3ipfs.aioz.network/api/apiKeys/' \
--header 'Authorization: Bearer JWT' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "test-api-key",
"scopes": {
    "admin": true,
    "data": {
        "pin_list": true,
        "nft_list":true
    },
    "pinning": {
        "unpin": true,
        "pin_by_hash": true,
        "pin_file_to_ipfs": true
    },
    "pin_nft":{
        "unpin_nft": true,
        "pin_nft_to_ipfs": true
    }
}
}'

List API Keys

This API allows you to retrieve a list of API keys associated with the authenticated user.

GEThttps://api.w3ipfs.aioz.network/api/apiKeys/list

Headers

Authorization* Bearer your_access_token_here

Response

200: OK
{ 
    "data": { 
        "total": 1, 
        "api_keys": [ 
            { 
                "id": "string", 
                "name": "string", 
                "api_key": "string", 
                "secret_key": "string", 
                "scopes": { 
                    "admin": true 
                }, 
                "created_at": "2023-01-01T11:11:11.111111Z" 
            } 
        ] 
    }, 
    "status": "success" 
} 
 
curl --location --request GET 'https://api.w3ipfs.aioz.network/api/apiKeys/list' \
--header 'Authorization: Bearer JWT' \

Delete API Key

This API allows you to delete an API key associated with the authenticated user.

DELETEhttps://api.w3ipfs.aioz.network/api/apiKeys/:id

Parameters

id* The unique identifier of the API key to be deleted.

Headers

Authorization* Bearer your_access_token_here

Response

200: OK
{ 
    "message": "API key has been deleted", 
    "status": "success" 
} 
curl --location --request DELETE 'https://api.w3ipfs.aioz.network/api/apiKeys/{ID}
--header 'Authorization: Bearer JWT'

Test Authentication

This API allows you to test the authentication and communication with the Web3 IPFS API using the provided pinning API key and secret key.

GEThttps://api.w3ipfs.aioz.network/api/apiKeys/testAuthentication

Headers

pinning_api_key* KEY
pinning_secret_key* SECRET

Response

200: OK
{
    "message": "Congratulations! You are communicating with the Web3 IPFS API!"
}
curl --location --request GET 'https://api.w3ipfs.aioz.network/api/apiKeys/testAuthentication' \
--header 'pinning_api_key: KEY' \
--header 'pinning_secret_key: SECRET'