> This page is for Developers.

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

# List custom object definitions

GET https://rest.test.zuora.com/objects/definitions/default

Get all custom objects definitions for a given tenant. If you want to copy all the existing custom objects from an old tenant to a new tenant, you can call this operation in your old tenant and then use its response directly as the request of the [Create custom object definitions](https://developer.zuora.com/api-references/api/operation/POST_CustomObjectDefinitions) call in the new tenant to import all the custom objects from the old tenant.


Reference: https://zuora.ferndocs.com/developers/api-reference/zuora-api/custom-objects/custom-object-definitions/get-all-custom-object-definitions-in-namespace

## Authentication

- `Authorization` header (bearer token, required) — Use `Bearer {{token}}` in the `Authorization` header for authentication.

## Servers

- `https://rest.test.zuora.com` (US Developer & Central Sandbox (incl. Test Drive), default)
- `https://rest.sandbox.na.zuora.com` (US API Sandbox Cloud 1)
- `https://rest.apisandbox.zuora.com` (US API Sandbox Cloud 2)
- `https://rest.na.zuora.com` (US Production Cloud 1)
- `https://rest.zuora.com` (US Production Cloud 2)
- `https://rest.test.eu.zuora.com` (EU Developer & Central Sandbox)
- `https://rest.sandbox.eu.zuora.com` (EU API Sandbox)
- `https://rest.eu.zuora.com` (EU Production)
- `https://rest.test.ap.zuora.com` (APAC Developer & Central Sandbox)
- `https://rest.ap.zuora.com` (APAC Production)

## Request

### Query parameters

- `select` (enum, optional) — If you set `select` to `type`, the response will only contain the `type` of each custom object.
  - Allowed values: `type`

### Headers

- `Accept-Encoding` (string, optional) — Include the `Accept-Encoding: gzip` header to compress responses as a gzipped file. It can significantly reduce the bandwidth required for a response. If specified, Zuora automatically compresses responses that contain over 1000 bytes of data, and the response contains a `Content-Encoding` header with the compression algorithm so that your client can decompress it.
- `Content-Encoding` (string, optional) — Include the `Content-Encoding: gzip` header to compress a request. With this header specified, you should upload a gzipped file for the request payload instead of sending the JSON payload.
- `Zuora-Track-Id` (string, optional) — A custom identifier for tracing the API call. If you set a value for this header, Zuora returns the same value in the response headers. This header enables you to associate your system process identifiers with Zuora API calls, to assist with troubleshooting in the event of an issue. The value of this field must use the US-ASCII character set and must not include any of the following characters: colon (`:`), semicolon (`;`), double quote (`"`), and quote (`'`).
- `Zuora-Entity-Ids` (string, optional) — An entity ID. If you have [Zuora Multi-entity](https://knowledgecenter.zuora.com/BB_Introducing_Z_Business/Multi-entity) enabled and the OAuth token is valid for more than one entity, you must use this header to specify which entity to perform the operation in. If the OAuth token is only valid for a single entity, or you do not have Zuora Multi-entity enabled, you should not set this header.
- `Zuora-Org-Ids` (string, optional) — Comma separated IDs. If you have Zuora Multi-Org enabled, you can use this header to specify which orgs to perform the operation in. If you do not have Zuora Multi-Org enabled, you should not set this header. The IDs must be a sub-set of the user's accessible orgs. If you specify an org that the user does not have access to, the operation fails. This header is important in Multi-Org (MO) setups because it defines the organization context under which the API should operate—mainly used for read access or data visibility filtering. If the header is not set, the operation is performed in scope of the user's accessible orgs.
- `Zuora-Version` (date, optional) — API version that determines the response schema. The default version is used if this parameter is not included. Specify `Zuora-Version` in the request header if you expect a specific response schema.

## Response

### 200

OK

- `count` (integer, optional) — The number of objects in the `definitions` object. The value of this field is the number of custom object definitions in the namespace.
- `definitions` (map from string to CustomObjectDefinition, optional) — The custom object definitions. This object maps types to custom object definitions.

## Types

### CustomObjectDefinition

- `CreatedById` (string, optional) — The creator's Id
- `CreatedDate` (datetime, optional) — The creation time of the custom object definition in date-time format.
- `Id` (string, optional) — The unique Id of the custom object definition
- `UpdatedById` (string, optional) — The modifier's Id
- `UpdatedDate` (datetime, optional) — The update time of the custom object definition in date-time format.
- `schema` (CustomObjectDefinitionSchema, optional) — The schema of the custom object definition
- `type` (string, optional) — The API name of the custom object

### CustomObjectDefinitionSchema

The schema of the custom object definition

- `auditable` (list of string, optional) — The set of fields which Audit Trail tracks and records changes of.
- `enableCreateRecordAuditing` (boolean, optional) — Indicates whether to audit the creation of custom object records of this custom object definition.
- `enableDeleteRecordAuditing` (boolean, optional) — Indicates whether to audit the deletion of custom object records of this custom object definition.
- `filterable` (list of string, optional) — The set of fields that are allowed to be queried on. Queries on non-filterable fields will be rejected. You can not change a non-filterable field to filterable.
- `label` (string, optional) — A label for the custom object
- `object` (string, optional) — The API name of the custom object
- `properties` (CustomObjectAllFieldsDefinition, optional) — The definitions of all the fields in the custom object definition
- `relationships` (list of CustomObjectDefinitionSchemaRelationshipsItems, optional) — An array of relationships with Zuora objects or other custom objects
- `required` (list of string, optional) — The required fields of the custom object definition. You can change required fields to optional. However, you can only change optional fields to required on the custom objects with no records.
- `type` (enum, optional) — The custom object definition type. Can only be `object` currently.
  - Allowed values: `object`
- `unique` (list of string, optional) — The fields with unique constraints.

### CustomObjectAllFieldsDefinition

The definitions of all the fields in the custom object definition

- `CreatedById` (CustomObjectAllFieldsDefinitionCreatedById, optional) — The `CreatedById` field definition
- `CreatedDate` (CustomObjectAllFieldsDefinitionCreatedDate, optional) — The `CreatedDate` field definition
- `Id` (CustomObjectAllFieldsDefinitionId, optional) — The `Id` field definition
- `UpdatedById` (CustomObjectAllFieldsDefinitionUpdatedById, optional) — The `UpdatedById` field definition
- `UpdatedDate` (CustomObjectAllFieldsDefinitionUpdatedDate, optional) — The `UpdatedDate` field definition

### CustomObjectDefinitionSchemaRelationshipsItems

- `cardinality` (enum, optional, default: manyToOne) — The cardinality of the relationship from this object to another object. A `manyToOne` relationship means this object is the child object (the "many" side), and the referenced object (the "one" side) is the parent. A `oneToMany` relationship means this object is the parent object (the "one" side), and the referenced object (the "many" side) is the child.
  - Allowed values: `manyToOne`, `oneToMany`
- `fields` (map from string to string, optional) — Field mappings in the form of `<this-object-field-name>`: `<other-object-field-name>`.
- `namespace` (string, optional) — The namespace where the related object is located
- `object` (string, optional) — The API name of the related object
- `recordConstraints` (CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraints, optional) — Specifies contraints to apply to custom object records.

### CustomObjectAllFieldsDefinitionCreatedById

The `CreatedById` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `uuid`
- `label` (string, optional) — The UI name of the field
- `origin` (enum, optional) — Specifies whether the field is a system field or a custom field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionCreatedDate

The `CreatedDate` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `date-time`
- `origin` (enum, optional) — Specifies the field is a system field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionId

The `Id` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `uuid`
- `label` (string, optional) — The UI name of the field
- `origin` (enum, optional) — Specifies whether the field is a system field or a custom field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionUpdatedById

The `UpdatedById` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `uuid`
- `label` (string, optional) — The UI name of the field
- `origin` (enum, optional) — Specifies whether the field is a system field or a custom field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectAllFieldsDefinitionUpdatedDate

The `UpdatedDate` field definition

- `format` (enum, optional) — The field data format
  - Allowed values: `date-time`
- `origin` (enum, optional) — Specifies the field is a system field
  - Allowed values: `system`
- `type` (enum, optional) — The field data type
  - Allowed values: `string`

### CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraints

Specifies contraints to apply to custom object records.

- `create` (CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraintsCreate, optional)

### CustomObjectDefinitionSchemaRelationshipsItemsRecordConstraintsCreate

- `enforceValidMapping` (boolean, optional) — Specifies whether Zuora validates the values of mapped fields in custom object records.

## Examples

**Response**

```json
{
  "CreatedById": "8ad084a67f9c7138017fab8a8b511b5a",
  "CreatedDate": "2024-11-15T06:13:27.338Z",
  "Id": "f67635c8-094e-4ffc-90be-5dba5c639494",
  "UpdatedById": "8ad084a67f9c7138017fab8a8b511b5a",
  "UpdatedDate": "2024-11-15T06:13:27.338Z",
  "schema": {
    "enableCreateRecordAuditing": false,
    "enableDeleteRecordAuditing": false,
    "enableRecordMigration": false,
    "filterable": [
      "OrderId__c",
      "Id",
      "CreatedDate",
      "UpdatedDate"
    ],
    "label": "Vehicle",
    "object": "Vehicle",
    "properties": {
      "CreatedById": {
        "label": "CreatedById",
        "origin": "system",
        "type": "string"
      },
      "CreatedDate": {
        "format": "date-time",
        "label": "CreatedDate",
        "origin": "system",
        "type": "string"
      },
      "DeviceId__c": {
        "label": "Device ID",
        "maxLength": 20,
        "origin": "custom",
        "type": "string"
      },
      "Id": {
        "format": "uuid",
        "label": "Id",
        "origin": "system",
        "type": "string"
      },
      "OrderId__c": {
        "format": "uuid",
        "label": "Order ID",
        "origin": "custom",
        "type": "string"
      },
      "UpdatedById": {
        "label": "UpdatedById",
        "origin": "system",
        "type": "string"
      },
      "UpdatedDate": {
        "format": "date-time",
        "label": "UpdatedDate",
        "origin": "system",
        "type": "string"
      }
    },
    "relationships": [
      {
        "cardinality": "manyToOne",
        "fields": {
          "OrderId__c": "Id"
        },
        "namespace": "com_zuora",
        "object": "orders",
        "recordConstraints": {
          "create": {
            "enforceValidMapping": true
          }
        }
      },
      {
        "cardinality": "manyToOne",
        "fields": {
          "CreatedById": "Id"
        },
        "namespace": "com_zuora",
        "object": "User",
        "recordConstraints": {
          "create": {
            "enforceValidMapping": true
          }
        }
      },
      {
        "cardinality": "manyToOne",
        "fields": {
          "UpdatedById": "Id"
        },
        "namespace": "com_zuora",
        "object": "User",
        "recordConstraints": {
          "create": {
            "enforceValidMapping": true
          }
        }
      }
    ],
    "required": [
      "Id",
      "CreatedById",
      "UpdatedById",
      "CreatedDate",
      "UpdatedDate"
    ]
  },
  "type": "Vehicle"
}
```

**SDK Code**

```python
import requests

url = "https://rest.test.zuora.com/objects/definitions/default"

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

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

print(response.json())
```

```javascript
const url = 'https://rest.test.zuora.com/objects/definitions/default';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

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

```go
package main

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

func main() {

	url := "https://rest.test.zuora.com/objects/definitions/default"

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

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

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

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

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

}
```

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

url = URI("https://rest.test.zuora.com/objects/definitions/default")

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

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

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

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

HttpResponse<String> response = Unirest.get("https://rest.test.zuora.com/objects/definitions/default")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://rest.test.zuora.com/objects/definitions/default', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://rest.test.zuora.com/objects/definitions/default");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.test.zuora.com/objects/definitions/default")! 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()
```