{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/instasent/json-schema/instasent-response-datasource-item-schema.json",
  "title": "ResponseDatasourceItem",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/instasent-datasource-api-openapi.yml#/components/schemas/ResponseDatasourceItem",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "uid": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "token": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "token": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "createdAt": {
          "type": "string"
        }
      }
    },
    "type": {
      "type": "string"
    },
    "integration": {
      "type": [
        "string",
        "null"
      ]
    },
    "deleted": {
      "type": "boolean"
    },
    "priority": {
      "type": "string"
    },
    "locale": {
      "type": "string"
    },
    "timezone": {
      "type": "string"
    },
    "defaultCountry": {
      "type": [
        "string",
        "null"
      ]
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    },
    "uniqueDsfield": {
      "type": [
        "string",
        "null"
      ],
      "description": "The unique identifier field for this datasource (e.g., `_user_id`)."
    },
    "sequenceDate": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the current data sequence started (used for CSV batch imports)."
    },
    "audienceTags": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      }
    },
    "projectAttributeMappings": {
      "type": [
        "array",
        "null"
      ],
      "description": "List of field mappings that define how datasource fields map to project attributes.",
      "items": {
        "$ref": "#/$defs/ProjectAttributeMapping"
      }
    }
  },
  "required": [
    "id",
    "uid",
    "name",
    "type",
    "integration",
    "locale",
    "timezone",
    "defaultCountry",
    "createdAt",
    "audienceTags"
  ],
  "x-stoplight": {
    "id": "6u3xd6qilofef"
  },
  "$defs": {
    "ProjectAttributeMapping": {
      "type": "object",
      "description": "Defines how a datasource field maps to a project attribute.",
      "properties": {
        "dsfield": {
          "type": "string",
          "description": "The datasource field name (e.g., `email`, `first_name`, `_user_id`)."
        },
        "projectAttributeUid": {
          "type": "string",
          "description": "UID of the project attribute this field maps to."
        },
        "label": {
          "type": "string",
          "description": "Human-readable label for the mapping."
        },
        "priority": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Optional custom priority for this field's value during merging. When null, the datasource default priority is used."
        },
        "autoSystemMapping": {
          "type": "boolean",
          "description": "Whether this mapping was auto-generated by the system."
        }
      },
      "required": [
        "dsfield",
        "projectAttributeUid",
        "label",
        "autoSystemMapping"
      ]
    }
  }
}