> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go.gbgplc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Step 4: Manage schemas

> Retrieve task schemas from the GBG GO API to understand the required fields, types, and validation rules before submitting data.

Each task in a journey includes a schema that defines the structure of data you must submit. This schema specifies the expected fields, types, and validation rules for completing the task. To understand the schema for passing customer data, check the [User data schema](/docs/go-v1/api-reference/schema) reference

Use the [Retrieve task schema (`/journey/task/schema`)](/docs/go-v1/api-reference/endpoint/retrieve-task-schema) endpoint to retrieve the schema for any task assigned to a journey instance.

## When to retrieve a task schema

You should fetch a task’s schema when:

* Preparing to submit data for a task
* Dynamically generating input fields in your UI
* Confirming the required fields and their formats
* Validating data before submitting it

## Prerequisites

Before sending the request, make sure you have:

* **Access token** – Get this from the [Authenticate](/docs/go-v1/developer-integration/execute-customer-journeys/authenticate) step
* **Task ID** – Returned when you [Retrieve tasks](/docs/go-v1/developer-integration/execute-customer-journeys/retrieve-tasks-step)
* (Optional) **Instance ID** – Needed in some journey configurations

## Retrieve task schema (API request)

Send a `POST` request to the [`/journey/task/schema`](/docs/go-v1/api-reference/endpoint/retrieve-task-schema) endpoint. Your request should be in this format:

```bash cURL theme={null}
curl --request POST \
  --url https://eu.platform.go.gbgplc.com/captain/api/journey/task/schema \
  --header 'Authorization: Bearer your_access_token' \
  --header 'Content-Type: application/json' \
  --data '{
    "taskId": "your-task-id"
  }'
```

If your journey configuration requires it, include the `instanceId` in the request body as well:

```json JSON theme={null}
{
  "taskId": "your-task-id",
  "instanceId": "your-instance-id"
}
```

If your request runs successfully, then you receive a response like this:

```json JSON expandable theme={null}
{
  "status": "InProgress",
  "instanceId": "QxLNUpNEPiFR9LurKp8BmJn3",
  "tasks": [
    {
      "taskId": "TkoviRO58Q8R7qPnAkLAqBAT",
      "variantId": "age_verification_all_ssn_dob_required",
      "schema": {
        "$ref": "#/schemas/dkBf7i_SNMGcfh3CK7z0W7326V2EYPfJ"
      }
    }
  ],
  "schemas": {
    "dkBf7i_SNMGcfh3CK7z0W7326V2EYPfJ": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "context": {
          "type": "object",
          "properties": {
            "subject": {
              "type": "object",
              "properties": {
                "identity": {
                  "type": "object",
                  "properties": {
                    "firstName": { "type": "string" },
                    "lastNames": { "type": "array", "items": { "type": "string" } },
                    "dateOfBirth": { "type": "string" },
                    "currentAddress": {
                      "type": "object",
                      "properties": {
                        "locality": { "type": "string" },
                        "postalCode": { "type": "string" },
                        "country": { "type": "string" }
                      }
                    }
                  },
                  "required": ["firstName", "lastNames"]
                }
              },
              "required": ["identity"]
            }
          },
          "required": ["subject"]
        }
      },
      "required": ["context"]
    }
  }
}
```

### How to use the schema

The schema defines:

* The field names, for example, document.type
* The data types, for example, string, array, or object
* Which fields are required
* Any format restrictions, for example, base64 for file uploads

You must use this structure when [submitting task data](/docs/go-v1/developer-integration/execute-customer-journeys/submit-task-data-step).

### Best practices

* Always retrieve the latest schema before submitting data.
* If the schema changes, update your integration to match the new structure.
* Validate your input locally using the schema before calling the API.

## Next step

Go to [Submit task data](/docs/go-v1/developer-integration/execute-customer-journeys/submit-task-data-step) to complete tasks using the retrieved schema.
