Get File Metadata
client.Beta.Files.GetMetadata(ctx, fileID, query) (*BetaFileMetadata, error)GET/v1/files/{file_id}
Get File Metadata
package main
import (
"context"
"fmt"
"github.com/anthropics/anthropic-sdk-go"
"github.com/anthropics/anthropic-sdk-go/option"
)
func main() {
client := anthropic.NewClient(
option.WithAPIKey("my-anthropic-api-key"),
)
betaFileMetadata, err := client.Beta.Files.GetMetadata(
context.TODO(),
"file_id",
anthropic.BetaFileGetMetadataParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", betaFileMetadata.ID)
}{
"id": "file_011CNha8iCJcU1wXNR6q4V8w",
"created_at": "2025-04-15T18:37:24.100435Z",
"filename": "document.pdf",
"mime_type": "application/pdf",
"size_bytes": 102400,
"type": "file",
"downloadable": false,
"expires_at": "2025-05-15T18:37:24.100435Z",
"scope": {
"id": "id",
"type": "session"
}
}Returns Examples
{
"id": "file_011CNha8iCJcU1wXNR6q4V8w",
"created_at": "2025-04-15T18:37:24.100435Z",
"filename": "document.pdf",
"mime_type": "application/pdf",
"size_bytes": 102400,
"type": "file",
"downloadable": false,
"expires_at": "2025-05-15T18:37:24.100435Z",
"scope": {
"id": "id",
"type": "session"
}
}