# Passing Parameters to Custom Scripts Used in TD Workflow

You can use environment variables to pass parameters and credentials to the custom script using _env.

See [Workflow Secret Management](/products/customer-data-platform/data-workbench/workflows/secret-management) for information about how to use workflow secrets.


```yaml
_env:
  TD_API_KEY: ${secret:apikey}
  TD_API_SERVER: ${secret:endpoint}
  AWS_ACCESS_KEY_ID: ${secret:aws_access_key_id}
  AWS_SECRET_ACCESS_KEY: ${secret:aws_secret_access_key}
```

To add a workflow secret to your custom script:

1. Declare the secret in your workflow definition (.dig file) custom script declaration. For example:



```yaml
+task1:
  py>: my_script.value_test
  _env:
    saved_value: ${secret:saved_value}
  docker:
    image: "<image_name>:<version>"
```

1. Access the secret from your custom script using the `os.environ.get` method.
2. Add it within your script. For example:



```python
import digdag
import os
import io

def value_test():
  # GET SAVED VALUE
  print(os.environ.get('saved_value'))
```