# AssetApiSchema

API Schema from a local asset.

The asset is uploaded to an S3 staging bucket, then moved to its final location
by CloudFormation during deployment.

Extends: ApiSchema › AssetApiSchema

- Source: [`aws-bedrockagentcore/lib/gateway/targets/schema/api-schema.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/gateway/targets/schema/api-schema.ts#L87)
- Type last changed: v2.255.0 · 19 May 2026

## Example

```ts

const gateway = new agentcore.Gateway(this, "MyGateway", {
  gatewayName: "my-gateway",
});

const smithySchema = agentcore.ApiSchema.fromLocalAsset(
  path.join(__dirname, "models", "smithy-model.json")
);
smithySchema.bind(this);

// Create a gateway target with Smithy Model and OAuth
const target = agentcore.GatewayTarget.forSmithy(this, "MySmithyTarget", {
  gatewayTargetName: "my-smithy-target",
  description: "Target for Smithy model integration",
  gateway: gateway,
  smithyModel: smithySchema,
});
```

## Initializer

```ts
new AssetApiSchema(path: string, options?: AssetOptions)
```

## Properties

- `bucketOwnerAccountId`: string — The account ID of the S3 bucket owner for cross-account access.

- `inlineSchema`: string — The inline OpenAPI schema definition as a string, if using an inline schema.

  Can be in JSON or YAML format.

- `s3File`: [Location](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Location.html) — The S3 location of the API schema file, if using an S3-based schema.

  Contains the bucket name and object key information.

## Methods

- `bind(scope: Construct): void` — Binds this API schema to a construct scope.

  This method initializes the S3 asset if it hasn't been initialized yet.
  Must be called before rendering the schema as CFN properties.

  **Parameters**

  - `scope` — - The construct scope to bind to.

- `fromInline(schema: string): InlineApiSchema` (static) — Creates an API Schema from an inline string.

  **Parameters**

  - `schema` — - the JSON or YAML payload defining the schema (OpenAPI or Smithy).

- `fromLocalAsset(path: string): AssetApiSchema // chainable` (static) — Creates an API Schema from a local file.

  **Parameters**

  - `path` — - the path to the local file containing the OpenAPI schema for the action group.

- `fromS3File(bucket: IBucket, objectKey: string, bucketOwnerAccountId?: string): S3ApiSchema` (static) — Creates an API Schema from an S3 File.

  **Parameters**

  - `bucket` — - the bucket containing the local file containing the OpenAPI schema for the action group.
  - `objectKey` — - object key in the bucket.
  - `bucketOwnerAccountId` — - optional The account ID of the Amazon S3 bucket owner.

- `grantPermissionsToRole(role: IRole): void` — Grant permissions to the role.
