# API

This API will allow you to create 1SatOrdinals Single and Collection Tokens.

## Common

#### An Api Key must be passed in the header of all requests see [Authentication](https://docs.taal.com/core-products/1sat-ordinals-tokens-api/broken-reference)

## Create a Token Studio Project for your Standalone - Collection

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/project/create
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/project/create' \
--header 'Apikey: ## VALID_API_KEY ##' \
--header 'Content-Type: application/json' \
--data '{
    "name": "1satcol project 1718100516565",
    "isFungible": false,
    "type": "single", //"collection"
    "tokenProtocol": "OneSatOrdinal"
}'


```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": boolean,
    "data": {
        "projectUid": <uid>
    }
}
```

{% endcode %}

## Get a list of your Token Studio projects

It will return all projects associated with your API Key.

{% code title="HTTP Request" %}

```
GET https://platform.taal.com/token-studio/api/v1/project/
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/project/' \
--header 'Apikey: ## VALID_API_KEY ##'
```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": boolean,
    "data": {
        "projectList": [
            {
                "uid": <uid>,
                "name": string,
                "network": string,
                "offChainData": {
                    "isFungible": boolean
                },
                "tokenProtocol": string
            }
        ]
    }
}
```

{% endcode %}

## Get details for a specific project id

Returns a project for a valid project id.

{% code title="HTTP Request" %}

```
GET https://platform.taal.com/token-studio/api/v1/project/<projectId>
```

{% endcode %}

{% code title="cURL" %}

```shell
  curl --location 'https://platform.taal.com/token-studio/api/v1/project/<projectId>' \
  --header "Apikey: ## VALID_API_KEY ##"
```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": true,
    "data": {
        "uid": <uid>,
        "name": string,
        "tokenProtocol": string,
        "network": string,
        "isFungible": boolean,
        "type": string
    }
}
```

{% endcode %}

**URL Parameters**

| Parameter | Description        |
| --------- | ------------------ |
| projectId | A valid project Id |

## Output creation

Creates an output (single, collection, collectinItem) in the project.&#x20;

Single projects can only contain single/standalone outputs

Collection projects need first a collection output created and then one or several collectionItems linked to the initial collection output

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-output
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-output' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json' \
--data '{
    "projectUid": "<projectId>",
    
    "contentType":"text/html;charset=utf8",
    "b64File":"PGh0bWw+PGJvZHk+SGVsbG8gV29ybGQ8L2JvZHk+PC9odG1sPg==",
    
    "metadata": {
        "name": "My single token 1718101145907",
         "subType": "single",
         "subTypeData": "{\"description\": \"this is description\" }",
        "type": "ord",
        "description": "this is a standalone token description",
        "info": "anything",
        "eyes": "green"
    }
}'

```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": true,
    "data": {
        "uid": <uid>,
        "type": string,
        "tokenProtocol": string
    }
}

```

{% endcode %}

**Body Parameters**

<table><thead><tr><th width="361">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>subType</td><td><ul><li>'single' for standalone tokens in single projects</li><li><p>'collection' for the seed token in collection projects</p><ul><li>'collectionItem' for each element linked to the collection</li></ul></li></ul></td></tr><tr><td>projectUid</td><td>projectUid</td></tr><tr><td>contentType</td><td>contentType depending on the desired output type (text, html or image)</td></tr><tr><td>b64File</td><td>Raw content formatted in b64</td></tr><tr><td>metadata</td><td><pre><code>Mandatory:
"name": NFT name
"type": "ord"
"subType": "single" //"collection" or "collectionItem",
"subTypeData": stringified JSON,
"description": string,
Other e.g. traits:
        "info": "anything",
        "eyes": "green"
</code></pre></td></tr></tbody></table>

## Output deletion

Deletes an output (single, collection, collectinItem) in the project.&#x20;

{% code title="HTTP Request" %}

```
DELETE https://platform.taal.com/token-studio/api/v1/output/{{outputUid}} 
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location --request DELETE 'https://platform.taal.com/token-studio/api/v1/output/{{outputUid}}' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json'

```

{% endcode %}

{% code title="Response JSON structure" %}

````json
```json
"success": true,
    "data": {
        "uid": "<uid>",
        "createdAt": "<timestamp>",
        "type": "token",
        "tokenProtocol": "OneSatOrdinal",
        "projectUid": "<uid>",
        "transactionUid": null,
        "txId": null,
        "identityUid": "<uid>",
        "address": null,
        "metadata": { <metadata>
        },
        "offChainData": {
            <fileData>
        }
    }
}
```
````

{% endcode %}

**Query Parameters**

| Parameter | Description       |
| --------- | ----------------- |
| outputUid | A valid output Id |

## Output List

Returns all outputs for a valid project id.

{% code title="HTTP Request" %}

```
GET https://platform.taal.com/token-studio/api/v1/output/by-project/{{projectUid}}?on-chain=0&type=collectionItem
```

{% endcode %}

{% code title="cURL" %}

```shell
  curl --location 'https://platform.taal.com/token-studio/api/v1/' \
  --header "Apikey: ## VALID_API_KEY ##"
```

{% endcode %}

{% code title="Response JSON structure" %}

```json
{
    "success": boolean,
    "data": {
        "outputList": [
            {
                "createdAt": <date>,
                "uid": <uid>,
                "projectUid": <uid>,
                "transactionUid": <uid> (null if has not been used in a transaction yet),
                "type": string,
                "tokenProtocol": string,
                "metadata": { //Key / value pairs e.g.
                    "app": string,
                    "eyes": string,
                    "info": string,
                    "name": string,
                    "type": string,
                    "subType": string,
                    "description": string,
                    "subTypeData": stringified JSON
                },
                "offChainData": {
                    "b64FileHash": string,
                    "b64FileSize": int,
                    "contentType": string
                }
            }
        ]
    }
}

```

{% endcode %}

**Query Parameters**

| Parameter  | Description                                                                                                        |
| ---------- | ------------------------------------------------------------------------------------------------------------------ |
| projectUid | A valid project Id                                                                                                 |
| on-chain   | Optional. If provided, the accepted values are 0/1 (false / true) to filter by outputs already broadcast           |
| type       | Optional. If provided, the accepted values are collection / collectionItem, to filter by a specific type of output |

## Unsigned Transaction creation

Creates an unsigned transaction ready to sign and then be broadcast.&#x20;

Unsigned transactions can refer to different outputs as well as different UTXO to be used for funding it

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-transaction
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/token/one-sat-ord/create-transaction' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json' \
--data '{
    "projectUid": "<projectUid>",
    "publicKey":  <Public Key>,
    "dstAddress": <Token Recipient Address>,
    "outputList": [<outputList>],
    "utxoList": [
        {
           "outputIndex": num,
            "txId": "<txId>"
        }
    ]
}'
```

{% endcode %}

Response JSON structure

```postman_json
{
    "success": boolean,
    "data": {
        "transactionUid": <uid>,
        "txObj": {<txObj>
        }
    }
}
```

**Body Parameters**

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>&#x3C;projectUid>
</code></pre></td><td>project Id</td></tr><tr><td><pre><code>&#x3C;publicKey>
</code></pre></td><td>publicKey</td></tr><tr><td><pre><code>dstAddress
</code></pre></td><td><pre><code>&#x3C;Token Recipient Address>
</code></pre></td></tr><tr><td><pre><code>outputList
</code></pre></td><td>List of output Ids</td></tr><tr><td><pre><code>txId
</code></pre></td><td>Funding txId</td></tr><tr><td><pre><code>outputIndex
</code></pre></td><td>Output Index of the tx e.g. 1</td></tr></tbody></table>

## Broadcast Transaction

Broadcast a signed transaction and returns its transaction Id

{% code title="HTTP Request" %}

```
POST https://platform.taal.com/token-studio/api/v1/submit
```

{% endcode %}

{% code title="cURL" %}

```shell
curl --location 'https://platform.taal.com/token-studio/api/v1/submit' \
--header "Apikey: ## VALID_API_KEY ##" \
--header 'Content-Type: application/json' \
--data '{
    "transactionUid": "<transactionUid>",
    "tx": "<txObjSigned>"
}
'
```

{% endcode %}

Response JSON structure

```postman_json
    {
      success: boolean,
      data: {
        txId: string
      }
    }

```

Body Parameters

<table><thead><tr><th>Parameter</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>transactionUid
</code></pre></td><td>Transaction Uid returned by the create transaction endpoint</td></tr><tr><td><pre><code>txObjSigned
</code></pre></td><td>Signed transaction ready to be broadcast</td></tr><tr><td></td><td></td></tr></tbody></table>
