> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fynapse.app/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fynapse.app/_mcp/server.

# Entity Metadata via API

> Learn how retrieve the information about Namespaces and Entities defined in Fynapse using REST API endpoints.

## Overview

You can retrieve the information about Namespaces and Entities defined in Fynapse using REST API endpoints.

## Managing Entities Using REST API

This section covers the steps required to retrieve information about Namespaces and Entities defined in Fynapse using REST API.

### Processing Diagram

The diagram below illustrates the flow of API calls when retrieving information about Namespaces and Entities:

### Example

This example refers to numbered steps on the diagram above.

#### Downloading a list of Namespaces

You can download a list of all Namespaces defined in Fynapse (1) using the **Get all Namespaces** endpoint.

### Request

GET [https://api.fynapse.com/api/v1/namespaces](https://api.fynapse.com/api/v1/namespaces)

**`Example Namespaces`**

```curl Example Namespaces
curl https://api.fynapse.com/api/v1/namespaces \
     -H "Authorization: Bearer <token>"
```

**`Example Namespaces`**

```python Example Namespaces
import requests

url = "https://api.fynapse.com/api/v1/namespaces"

headers = {"Authorization": "<token>."}

response = requests.get(url, headers=headers)

print(response.json())
```

**`Example Namespaces`**

```javascript Example Namespaces
const url = 'https://api.fynapse.com/api/v1/namespaces';
const options = {method: 'GET', headers: {Authorization: '<token>.'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Example Namespaces`**

```go Example Namespaces
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fynapse.com/api/v1/namespaces"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<token>.")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Example Namespaces`**

```ruby Example Namespaces
require 'uri'
require 'net/http'

url = URI("https://api.fynapse.com/api/v1/namespaces")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<token>.'

response = http.request(request)
puts response.read_body
```

**`Example Namespaces`**

```java Example Namespaces
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.fynapse.com/api/v1/namespaces")
  .header("Authorization", "<token>.")
  .asString();
```

**`Example Namespaces`**

```php Example Namespaces
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.fynapse.com/api/v1/namespaces', [
  'headers' => [
    'Authorization' => '<token>.',
  ],
]);

echo $response->getBody();
```

**`Example Namespaces`**

```csharp Example Namespaces
using RestSharp;

var client = new RestClient("https://api.fynapse.com/api/v1/namespaces");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<token>.");
IRestResponse response = client.Execute(request);
```

**`Example Namespaces`**

```swift Example Namespaces
import Foundation

let headers = ["Authorization": "<token>."]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fynapse.com/api/v1/namespaces")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Response (200)

```json
{
  "data": [
    {
      "name": "fynapse"
    },
    {
      "name": "custom-namespace"
    }
  ]
}
```

#### Downloading a list of Entities in a Namespace

You can download a list of all Entities configured in a given Namespace using the **Get the list of Entities in a Namespace** endpoint.

### Request

GET [https://api.fynapse.com/api/v1/namespaces/\{namespace}/entities](https://api.fynapse.com/api/v1/namespaces/\{namespace}/entities)

**`Example Entities`**

```curl Example Entities
curl https://api.fynapse.com/api/v1/namespaces/namespace/entities \
     -H "Authorization: Bearer <token>"
```

**`Example Entities`**

```python Example Entities
import requests

url = "https://api.fynapse.com/api/v1/namespaces/namespace/entities"

headers = {"Authorization": "<token>."}

response = requests.get(url, headers=headers)

print(response.json())
```

**`Example Entities`**

```javascript Example Entities
const url = 'https://api.fynapse.com/api/v1/namespaces/namespace/entities';
const options = {method: 'GET', headers: {Authorization: '<token>.'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Example Entities`**

```go Example Entities
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fynapse.com/api/v1/namespaces/namespace/entities"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<token>.")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Example Entities`**

```ruby Example Entities
require 'uri'
require 'net/http'

url = URI("https://api.fynapse.com/api/v1/namespaces/namespace/entities")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<token>.'

response = http.request(request)
puts response.read_body
```

**`Example Entities`**

```java Example Entities
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.fynapse.com/api/v1/namespaces/namespace/entities")
  .header("Authorization", "<token>.")
  .asString();
```

**`Example Entities`**

```php Example Entities
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.fynapse.com/api/v1/namespaces/namespace/entities', [
  'headers' => [
    'Authorization' => '<token>.',
  ],
]);

echo $response->getBody();
```

**`Example Entities`**

```csharp Example Entities
using RestSharp;

var client = new RestClient("https://api.fynapse.com/api/v1/namespaces/namespace/entities");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<token>.");
IRestResponse response = client.Execute(request);
```

**`Example Entities`**

```swift Example Entities
import Foundation

let headers = ["Authorization": "<token>."]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fynapse.com/api/v1/namespaces/namespace/entities")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Response (200)

```json
{
  "data": [
    {
      "name": "journal",
      "temporalityType": "Transaction",
      "description": "Journal Entity"
    },
    {
      "name": "fxRates",
      "temporalityType": "Transaction",
      "description": "FX Rate Entity"
    },
    {
      "name": "balance",
      "temporalityType": "Transaction",
      "description": "Balance Entity"
    }
  ]
}
```

#### Downloading an Entity schema

You can retrieve an Entity schema as an object using the **Get an Entity schema from the Namespace** endpoint. Each Entity comprises of an ordered list of attributes. The attributes define the name, structure, and constraints of an Entity.

> **Info**
>
> For more details about Entity structure, refer to [Data Structure Definition](/documentation/instance-management/data-structure/data-structure-definition).

### Request

GET [https://api.fynapse.com/api/v1/namespaces/\{namespace}/entities/\{entityName}/schema](https://api.fynapse.com/api/v1/namespaces/\{namespace}/entities/\{entityName}/schema)

**`Example Journal Schema`**

```curl Example Journal Schema
curl https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema \
     -H "Authorization: Bearer <token>"
```

**`Example Journal Schema`**

```python Example Journal Schema
import requests

url = "https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema"

headers = {"Authorization": "<token>."}

response = requests.get(url, headers=headers)

print(response.json())
```

**`Example Journal Schema`**

```javascript Example Journal Schema
const url = 'https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema';
const options = {method: 'GET', headers: {Authorization: '<token>.'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Example Journal Schema`**

```go Example Journal Schema
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<token>.")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Example Journal Schema`**

```ruby Example Journal Schema
require 'uri'
require 'net/http'

url = URI("https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<token>.'

response = http.request(request)
puts response.read_body
```

**`Example Journal Schema`**

```java Example Journal Schema
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema")
  .header("Authorization", "<token>.")
  .asString();
```

**`Example Journal Schema`**

```php Example Journal Schema
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema', [
  'headers' => [
    'Authorization' => '<token>.',
  ],
]);

echo $response->getBody();
```

**`Example Journal Schema`**

```csharp Example Journal Schema
using RestSharp;

var client = new RestClient("https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "<token>.");
IRestResponse response = client.Execute(request);
```

**`Example Journal Schema`**

```swift Example Journal Schema
import Foundation

let headers = ["Authorization": "<token>."]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fynapse.com/api/v1/namespaces/namespace/entities/entityName/schema")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

Below is an example of Journal Entity schema:

### Response (200)

```json
{
  "name": "JournalInput",
  "temporalityType": "Transaction",
  "description": "Journal Input",
  "primaryKeyAttributeNames": [
    "originJournalId"
  ],
  "attributes": [
    {
      "name": "originJournalId",
      "label": "originJournalId",
      "type": null,
      "mandatory": true
    },
    {
      "name": "lines",
      "label": "Journal Lines",
      "type": {
        "typeName": "ListType",
        "itemType": {
          "typeName": "InlineEntityType",
          "definition": {
            "name": "JournalInputLine",
            "temporalityType": "Transaction",
            "description": "Journal Input Line",
            "primaryKeyAttributeNames": [
              "journalLineNo"
            ],
            "attributes": [
              {
                "name": "originJournalLineId",
                "label": "originJournalLineId",
                "type": "TEXT",
                "mandatory": false
              },
              {
                "name": "journalLineNo",
                "label": "Journal Line No",
                "type": "UUID",
                "mandatory": true
              },
              {
                "name": "coreDate",
                "label": "Core Date",
                "type": "DATE",
                "mandatory": true
              },
              {
                "name": "accountingConfig",
                "label": "Accounting Config",
                "type": "TEXT",
                "mandatory": true
              },
              {
                "name": "journalType",
                "label": "Journal Type",
                "type": "TEXT",
                "mandatory": true
              },
              {
                "name": "account",
                "label": "Account",
                "type": "TEXT",
                "mandatory": true
              },
              {
                "name": "amount",
                "label": "Trx Amount",
                "type": "DECIMAL",
                "mandatory": true
              },
              {
                "name": "currency",
                "label": "Trx Currency",
                "type": "TEXT",
                "mandatory": true
              },
              {
                "name": "entity",
                "label": "Entity",
                "type": "TEXT",
                "mandatory": true
              },
              {
                "name": "product",
                "label": "Product",
                "type": "TEXT",
                "mandatory": true
              },
              {
                "name": "uuidParam",
                "label": "uuidParam",
                "type": "UUID",
                "mandatory": false
              },
              {
                "name": "intParam",
                "label": "intParam",
                "type": "INT",
                "mandatory": false
              }
            ]
          }
        }
      },
      "mandatory": true
    }
  ]
}
```