> For the complete documentation index, see [llms.txt](https://docs.finenex.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.finenex.net/application-apis/ipfs-apis/api-references.md).

# API References

### Add

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/add" method="post" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Request Body

This endpoint expects one or several files (depending on the command) in the body of the request as 'multipart/form-data'.

The `add` command not only allows adding files, but also uploading directories and complex hierarchies.

This happens as follows: Every part in the multipart request is a *directory* or a *file* to be added to IPFS.

Directory parts have a special content type `application/x-directory`. These parts do not carry any data. The part headers look as follows:

```
Content-Disposition: form-data; name="file"; filename="folderName"
Content-Type: application/x-directory
```

File parts carry the file payload after the following headers:

```
Abspath: /absolute/path/to/file.txt
Content-Disposition: form-data; name="file"; filename="folderName%2Ffile.txt"
Content-Type: application/octet-stream

...contents...
```

The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request.

The `Abspath` header is included for filestore/urlstore features that are enabled with the `nocopy` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'POST' \
  '{endpoint}/ipfs/add' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@file.yaml'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "cid": "QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN"
}
```

{% endtab %}
{% endtabs %}

### Cat

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/{cid}" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
File contents
```

{% endtab %}
{% endtabs %}

### Get

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/{cid}/get" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN/get?filename=temp' \
  -H 'accept: application/x-tar' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
Tar file
```

{% endtab %}
{% endtabs %}

### Id

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/id" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/id' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "id": "12D3KooWN4tTkHvjMttH77tMtcTBz5HJqEfNveJsnDo828JjHcjL"
}
```

{% endtab %}
{% endtabs %}

## Version <a href="#api-v0-version" id="api-v0-version"></a>

{% openapi src="/files/QTU4j8fMYG9Fmsrk3GXJ" path="/ipfs/version" method="get" %}
[ipfs.yaml](https://1515857786-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5KMVYVhl4nQjYvpkUrV4%2Fuploads%2Fxv4gWSnDg2KetPTwCeWK%2Fipfs.yaml?alt=media\&token=312e329b-4066-4a6d-8cdf-7389dfefe1c5)
{% endopenapi %}

#### Example

{% tabs %}
{% tab title="Request" %}

```
curl -X 'GET' \
  '{endpoint}/ipfs/version' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
```

{% endtab %}

{% tab title="Response" %}

```
{
  "version": "0.10.0"
}
```

{% endtab %}
{% endtabs %}
